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 lots of time. If you happen to mistype a command, pressing the up arrow and then using the left arrow to correct the error can also save time.


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