The command prompt in Windows 8 and Windows 7 is the shell environment where you can run text-based console tools and utilities by typing commands. It's UI is very simple and does not have any buttons or graphical commands. But it provides a set of useful hotkeys. Today, I would like to share this list of command prompt hotkeys available in Windows 8 and Windows 7. They should also work in Windows Vista or Windows XP.
Up arrow key or F5 - returns to the previous command. The command prompt stores a history of the commands you type in one session until you exit it. Every time you press the Up arrow key or F5, the command prompt will cycle through the previously entered commands one-by-one in the reverse order of input.
Down arrow key - scrolls the command history in the order in which they were entered in one session, meaning, the down arrow key's order of cycling through commands is opposite to the Up arrow key.
The Up and Down arrow keys store the position in the command history until you execute a new command. After that, the newly executed command will be added to the end of the command history and its position will be lost.
ESC - clears the entered text.
Tab - auto-completes the file name or directory/folder name. For example, if you type c:\prog in the command prompt window and then press the Tab key, it will be replaced with "c:\Program Files". Similarly, if you are at C:\ and you type, CD C:\Win and press the Tab key, it will be auto complete C:\Windows for you, This is a very useful key and can be customized from the Registry. You can even set separate keys for filename completion and directory completion.
F1 - Displays previously typed command(s) one character at a time. Press the Up arrow to display some previously entered command and press Escape to clear the command line. Now press F1 multiple times: every time you press F1, one character from the command will appear on the screen.
F2 - repeats the previous command in history from the beginning up to the specified character. For example, I have dir c: in my history. I can locate it in the history using the Up arrow.
Then if I press Esc to clear the input and press F2, it will ask me for char to copy up to:
To copy only the portion of the command up to "dir", enter space bar (space) as the character to copy up to.
F3 - repeats the previously typed command. It acts like the Up arrow key, but repeats only one command.
F4 - Deletes the text to the right of the cursor position up to the specified character
In the example above, the cursor is located at "e" char, so when I specify "o", it will delete the characters "ech":
Alt+F7 - clears the command history. All your input history will be erased.
F8 - moves backwards through the command history, but only display commands which begin at the specified character. You can use this option to filter your history. For example, if you type cd at the input line and then press F8, it will cycle through only those commands in your history which begins with "cd".
Ctrl + Home - deletes all the text to the left of the current input position.
Ctrl + End - deletes all the text to the right of the current input position.
Ctrl + Left arrow - moves your cursor to the first character of each word towards the left.
Ctrl + Right arrow - moves your cursor to the first character of each word towards the right.
Ctrl + C - aborts currently running command or batch file.
Enter - Copies the selected/marked text. You can mark text by single clicking the Command prompt icon in the title bar and then choosing Edit -> Mark. After clicking Mark, you must select text by drag and drop using the mouse or by using Shift+Left/Right arrow keys. If Quick Edit Mode is turned on from Properties, then you only need to directly drag and drop, there is no need to go to Edit -> Mark.
Insert - Toggles between insert mode and overwrite mode at the current cursor position. In overwrite mode, the text you type will replace any text following it.
Home - Moves to the beginning of the command
End - Moves to the end of the command
Alt+Space - shows the window menu of the Command Prompt. This menu contains very useful functions under the Edit submenu besides Defaults and Properties. Regular window shortcuts also work, so you can press Alt+Space and then C to close the command prompt window instead of typing Exit.
That's it. If you know more hotkeys, you're welcome to comment.
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!