What Does the F1 Key Do in MS-DOS 6.22?

In MS-DOS 6.22, pressing the F1 function key at the command line interface copies the previous command from the internal memory buffer onto the screen one character at a time. This feature provides a quick way to reuse, audit, or make minor modifications to the last executed command without having to retype the entire line from scratch.

The Command Buffer and Template

MS-DOS stores the most recently entered command string in a temporary memory buffer known as the "template." When the user sits at an empty command prompt (such as C:\>), this template remains loaded until a new command replaces it or the system restarts.

Pressing F1 advances a hidden pointer through this template:

  1. First Press: The first character of the previously executed command appears at the prompt.
  2. Subsequent Presses: Each additional press of F1 appends the next sequential character from the template to the current cursor position.
  3. End of Template: Once every character from the previous command has been placed on the screen, pressing F1 further produces no effect.

(Note: The Right Arrow key on the standard keyboard functions identically to F1 in the default command processor.)

Practical Example

If the last command typed was:

DIR C:\DOCUMENTS

After pressing Enter to execute that command, the prompt resets:

C:\>

Pressing F1 four times results in:

C:\>DIR 

At this stage, you can either continue pressing F1 to reveal more of the original path, or type a new directory name manually (e.g., C:\GAMES), effectively reusing the DIR portion of the instruction.

Differences When Using DOSKEY

By default, standard MS-DOS command editing is handled directly by COMMAND.COM. If the TSR (Terminate and Stay Resident) utility DOSKEY.COM is loaded into memory, the command-line interface upgrades to support full command history and rich cursor navigation.

Even with DOSKEY active, the F1 key retains its original legacy behavior: it still recalls the template character by character. However, DOSKEY allows users to use the Up and Down arrow keys to cycle through entire commands, reducing the reliance on F1 for basic command retrieval.