View command history and quickly repeat DOS commands

Updated: 04/26/2017 by Computer Hope
Windows DOS command prompt window

While at the MS-DOS prompt or in the Windows command line you can quickly repeat any previously entered command and view a history of commands using the arrow keys. For example, if you previously used the dir command to list the files in the current directory press the up arrow key to repeat that command. Continuing to press the up arrow scrolls through a list of commands used earlier.

For anyone who enters long commands, file names, or directory names this can save a lot of time. If you mistype a command, pressing the up arrow and then using the left arrow to correct the error can also save time.

Tip

This option is available in MS-DOS and the Windows command line using the doskey command. See our doskey command page if you need additional help or to view all the available options for this command.