Many times power users, administrators and developers use Command Prompt in Windows to execute various commands. Today in this topic, we are going to put a comprehensive list of all useful keyboard shortcuts for Command Prompt which can help you in executing the commands quickly and easily.
Up Arrow or F5: Cycles through previous commands from command history
If you have run commands in a Command Prompt window, you can press "Up" key to cycle through them. Press "Down" key to go the next command.
Pressing "F5" key also does the same job.
Tab: Auto-fills file/folder names
If you type a character and press "Tab" key, it'll automatically fill the matching file/folder name present in the current directory. You can cycle through all matching names by pressing "Tab" key continuously.
Right Arrow or F1: Auto-fills characters from previous command one by one
If you press "Right" key or "F1" key, it'll start typing characters from the previously executed command one by one.
F2: Copies characters from previous command
If you want to copy certain number of characters from previously executed command, you can press "F2" key. It'll ask the character name to copy up to, type the character name and press Enter.
For example, you executed CD Windows command. Now if you press "F2" key and type o when it asks for "Enter char to copy up to", it'll automatically copy and fill CD Wind in Command Prompt.
Esc: Erases current line
If you type a command but don't want to execute it, simply press "Esc" key and it'll erase the typed line.
F3: Repeats last command
You can automatically fill the previously executed command by pressing "F3" key. When you press "F3" key, it repeats the last command.
F7: Shows list of all previous commands from command history
You can press "F7" key to get a list of all previously executed commands and then you can use Up or Down arrow keys to cycle though them. Press Enter to execute the selected command.

F9: Asks for command number and executes it
Its similar to "F7" key. You just need to remember the number of a previously executed command, press "F9" key and it'll ask "Enter command number". Type the command number and press Enter and it'll execute the command.
F8: Type character and press F8 key to cycle though matching commands
Type a few characters and press "F8" key and it'll automatically fill the matching command. Keep pressing "F8" key will cycle though all matching commands.
Alt+F7: Clears command history
You can clear the whole command history by pressing "Alt" and "F7" keys together.
This article was posted by VG in following section: Windows 7, Windows Vista, Windows XP.
If you enjoyed this article, subscribe to our RSS feed or free newsletter to get all new articles directly in your Inbox. Also check out our popular articles and archive to read other interesting articles.
Yvidhiatama
Now this is what I am looking for!
@VG: Can you post another article that has the information about some useful command line options in CMD? Thanks!
j_veen
TQ for this unique tips..
VG
@Yvidhiatama
What do you mean with command line options? Do you want an article for its Settings details or article for various commands?
EGA
nice tutor VG, could post a tutor for making a batch file to run two or more command at once?
Yvidhiatama
@VG: Yes please.
Yvidhiatama
@VG: I want the article of various commands.
Uewd
Nice topic. Some I know and some I didn't. Thanks for sharing!
VG
@Yvidhiatama
Check following:
microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx
@EGA
Check following:
technet.microsoft.com/en-us/library/bb490869.aspx