The Command Prompt aka cmd is one of the core components of the Microsoft Windows OS. It is also one of the most useful parts of Windows. It lets you perform several tasks which cannot be accomplished easily using the GUI. In fact, it won’t be an exaggeration if we call it the real Control Panel of Windows. Despite its significance, many Windows users are still unaware about most of its powerful features.
#1 Abort a running command
Did you know you can stop a command running in the Command Prompt before it completes its task? Well, you can do this by pressing Ctrl + C during the execution of the command.
#2 Save the output of a command to a file
Sometimes you may need to save the output of a command to a file for future reference, or maybe for posting it in some forum for getting help from others regarding the error(s) displayed in the output of that command. You can do this easily by typing <command> “>” (without quotes) followed by a filename after the command you’re going to execute.
For example, ipconfig /all > codingsec.txt
#3 Copy the output of a command to clipboard
To copy the output of a command to clipboard instead of saving it to a file, you can type <command> | clip
For example, ipconfig /all | clip
#4 Run multiple commands simultaneously
Did you know you could execute multiple commands simultaneously? No? In that case, you have been missing a great functionality of the Command Prompt. You can run multiple commands at the same time using “&&” (without quotes) between two commands and pressing Enter. The command on the left will be executed first, followed by the next command, and so on.
For example, dir && ipconfig /all
#5 Use Autocomplete while typing the location of directory or file
Did you ever have to the location of a directory like “D:ProjectsOpenglwincodebitsRotating cubeDebug” in the Command Prompt? If you did, you definitely know how annoying it is !!! But you need not worry anymore We have a solution for your problem. You can use the Autocomplete feature of Command Prompt. Here’s how to do this :
Say you’re in the drive D: and you need to navigate to D:ProjectsOpenglwincodebitsRotating cubeDebug.
Normally, you’d type this : cd ProjectsOpenglwincodebitsRotating cubeDebug
However, you can just type cd and the rest can be navigated using the TAB key. Try this – type cd and then press the TAB key until the name of the desired directory shows up next to cd. Then type and again keep pressing TAB until the desired directory comes up. Keep doing this, until you have reached your destination and press Enter.
#6 View a navigable list of all the commands recently used by you
The Command Prompt stores a list of all the commands used by you recently i.e. in the current cmd session. You can view a navigable and selectable list of recently used commands i.e. you can navigate up and down in that list and select one of those commands. You can do this by pressing the F7 key.
Now, you can select text using the left-button of the mouse and press the Enter key and paste it anywhere in the cmd window by clicking the right mouse button.
If you don’t want to enable QuickEdit, you can still copy/paste text. However, the process would be a little inconvenient. You’ll have to right-click inside the cmd window and select Mark from the pop-up menu. Then, select the text and press Enter. Now, right-click again and select Paste from the pop-up menu.
#7 Run cmd as admin without using the mouse
There are several commands that require the Administrator’s privilege. For running these commands, you need to run cmd as administrator. However, right-clicking the cmd.exe file and selecting Run as Administrator from the list is highly inconvenient. We can help you make cmd run with Administrator’s privileges everytime without using the mouse. There are two ways to do this:
a) Type cmd in the Start Menu’s search box and press Ctrl + Shift + Enter
b) Create a shortcut of cmd. Right click the shortcut file and click on Properties. Under the Shortcut tab, click on the button named Advanced. A new dialog box appears. Check the checkbox labelled Run as Administrator and Click OK. Click OK again to close the Properties Window of the shortcut. Now, whenever you want to open a command prompt window with administrator’s privileges, you’ll have to only double-click this shortcut.
#8 Use function keys in the Command Prompt
The function keys play a significant role in Windows. For example, you know that F1 shows Windows Help, F2is used to rename files and folders, F3 is used to search for files and folders and so on. But did you know that these function keys play a very useful role in the Command Prompt as well? Perhaps not. Here, we’ve listed the function keys that work in the Command Prompt as well as the task they perform :
a) F1 – It pastes the command that was last executed by the Command Prompt, one character at a time.
For example, if the last command was dir, you’ll have to press F1 three times because dir has three characters.
b) F2 – It pastes the command that was last executed by the Command Prompt, however, it asks you to enter a character upto which you want to paste the command.
For example, if the last command was ipconfig /displaydns and you press d after pressing F2, the Command prompt will paste ipconfig / i.e. it will paste all characters before d.
c) F3 – It pastes the last executed command (the whole command).
For example, if the last command was ipconfig /displaydns and you press F3, the Command Prompt will paste ipconfig /displaydns at the location of the cursor.
d) F4 – It displays a dialog which asks the user to enter the character to delete up to.
Note :- When I pressed F4 in my Command Prompt Window, it showed the dialog box mentioned above, but it did not perform any task, no matter which character I entered.
e) F5 – It pastes the last executed command. When pressed repeatedly, it shows all the commands executed, in the reverse order of execution. Once the oldest command i.e. the command which was the first to be executed in that cmd session has been displayed, pressing the F5 key does nothing.
f) F6 – Pastes ^Z to the command prompt.
g) F7 – It displays a navigable list of previously used commands in the form of a dialog.
h) F8 – It pastes recently executed commands. Please note that it is different from F5 because it keeps cycling the previously used commands.
i) F9 – As mentioned above, the command prompt stores a list of all the executed commands. This list is numbered from 0 to 9. When you press F9, you’re asked to enter the number of the command, which you want to use.
For example, to use the first command, type 0. For using the third command, type 2, and so on.
#9 Drag & Drop a file/folder inside Command Prompt
In #5 above, we mentioned how to use autocomplete in Command Prompt and avoid the messy job of typing the entie location of a file/folder. Here we have something even better. You can just drag a file/folder into the Command Prompt window in order to paste its location in the command prompt window.
#10 Get detailed help for commands whose syntax you don’t know
This is one of those tips you can’t afford to miss. Say, you don’t know what is the syntax of the command diris, or what task it performs. You can easily know all about dir by typing help dir. Similarly, most commands would show their information if you type help <command>.