Revision #11

You are currently reviewing an older revision of this page.
Go to current version

Doskey has been around since the early MS-DOS days, and it’s just as useful today as it was when it first came out. It keeps a history of the commands you’ve entered and enables you to easily retrieve them so that you don’t have to type them again (although doskey have several other functionalities). This saves a lot of time when you’re entering the same commands repeatedly and is especially useful when you’re entering long commands, where typos are common.

For example, suppose you’re troubleshooting connectivity with another system and you’re using either of the following two commands:

  • ping 192.168.0.1
  • ipconfig /all

The next time you want to execute either of these commands, press Up Arrow until the command is displayed at the prompt, and then press Enter; the same command executes again without requiring you to type it from scratch.

The following table lists and describes the keys you can use to retrieve commands:

 Keyboard Key  Description
 Up Arrow  Recalls the previous command.
 Down Arrow  Recalls the command used after the currently displayed command.
 Page Up  Recalls the oldest command in the current session.
 Page Down  Recalls the most recent command in the current session.

Note: After you have made an edit to a command, you do not have to reposition the cursor at the end of the line. Simply press Enter to continue.

You can use the following keys or key combinations when editing commands:

Keyboard Key / Key Combination  Description
 Left Arrow Moves the cursor back one character at a time.
 Right Arrow Moves the cursor forward one character at a time.
 Ctrl+Left Arrow Moves the cursor back one word.
 Ctrl+Right Arrow Moves the cursor forward one word.
 Home Moves the cursor to the beginning of the line.
 End Moves the cursor to the end of the line.
 Esc Clears the command from the display.
 F5
Copies the previous command into the current command line.
 F7
Displays the command history in a selectable pop-up dialog box. Look at the following example:


 ALT+F7
Deletes all commands stored in memory for the current history buffer.

Note: Another way to achieve the same result is to executing the "cmd.exe" command from the Command  Prompt Window. Look at the following figure:



Note: The doskey buffer will hold the past 50 commands by default. However, you can change that by right-clicking the title bar of the Command Prompt window, choosing Properties, and changing the Buffer Size option as your needs. Look at the following figure:





Note: Although in Microsoft's documents is mentioned that you can use doskey /listsize command to change the buffer size, this is not true!!! Although the execution of this command is appears as successful, but it does not have any effects. Look at the following figure:



Following are some of the useful commands you can use with doskey:

  • doskey /history --> Lists all commands in the history buffer. Look at the following figure:



  • doskey /reinstall --> Installs a new copy of doskey.exe and clears the command history buffer. Look at the following figure:



For more information about Doskey's functionality, click here.