The command prompt, also known as CMD, is one of the core components of the Microsoft Windows operating system. It is also one of the most useful parts of Windows. It allows you to perform several tasks that are not easily accomplished using the GUI. In fact, if we call the real control panel of Windows, this is not an exaggeration. Still, many Windows users still don’t understand most of their features. Therefore, we think that the top ten cmd tips that every Windows user must know are listed!
Top ten cmd tips
#1 aborting a running command
Do you know that you can stop the commands that are run at the command prompt before completing the task? Then you can do this by pressing Ctrl + C while executing the command.
#2 Save the output of the command to a file
Sometimes you may need to save the output of a command to a file for future reference, or you may need to publish it in a forum to get help from others about the errors displayed in the output of the command. You can do this easily by typing <command> “>” (without the quotation marks) after the command is executed, and then entering the file name.
For example, ipconfig / all> codingsec.txt
#3 Copy the output of the command to the clipboard
To copy the output of the command to the clipboard instead of saving it to a file, type <command> | clip
For example, ipconfig / all | clip
#4-Run multiple commands at the same time
Do you know that you can execute multiple commands at the same time? No? In this case, you have missed the command prompt feature. You can use the “&&” between two commands (without the quotation marks) while pressing the Enter key to run multiple commands at the same time. The command on the left will be executed first, followed by the next command, and so on.
For example, dir && ipconfig / all
#5- When entering the location of a directory or file, use autofill
Do you have a directory location such as “D:ProjectsOpenglwincodebitsRotating cubeDebug” at the command prompt? If you do this, you must know how much trouble this is! But you don’t have to worry about having a solution to your problem. You can use the auto-completion feature of the command prompt. Here’s how to do this:
Say you are on drive D: you need to navigate to D:ProjectsOpenglwincodebitsRotating cubeDebug.
Usually, you can type the following: cd Projects Opengl wincodebits Rotating cube Debug
However, you can type cd and the rest can be navigated using the TAB key. Try this – type cd and press TAB until the name of the desired directory is displayed next to cd. Then type and press TAB again until the desired directory appears. Keep doing this until you reach your destination and press Enter.
#6- View a navigation list of all the commands you have used recently
The command prompt stores a list of all the commands you have used recently, in the current cmd session. You can view a navigation and an optional list of recently used commands, where you can navigate up and down and select one of the commands. You can press the F7 key.
Now you can select the text with the left mouse button and press Enter, then paste it anywhere in the cmd window by right-clicking.
If you don’t want to enable QuickEdit, you can still copy/paste text. However, this process will be a bit inconvenient. You must right click in the cmd window and select the tag from the popup menu. Then, select the text and press Enter. Now right click again and select Paste from the popup menu.
#7 Run cmd as an administrator without using the mouse
There are several commands that require administrator privileges. For running these commands, you need to run cmd as an administrator. However, it is very inconvenient to right-click on the cmd.exe file and select to run as an administrator from the list. We can help you run cmd with administrator privileges each time without using a mouse. There are two ways to do this:
a) Type cmd in the search box on the Start menu, then press Ctrl + Shift + Enter
b) Create a shortcut to cmd. Right-click the shortcut file and click Properties. Under the Shortcuts tab, click the button named Advanced. A new dialog will appear. Select the Run as administrator check box and click OK. Click OK again to close the properties window for the shortcut. Now whenever you open a Command Prompt window with administrator privileges, you must double-click this shortcut.
#8 Using the function keys at the command prompt
Function keys play an important role in Windows. For example, you know that F1 shows Windows help, F2 for renaming files and folders, and F3 for searching files and folders. But do you know that these function keys also play a very useful role in the command prompt? Maybe not here, we’ve listed the function keys that work in the command prompt and the tasks they perform:
a) F1 – It pastes the last command executed by the command prompt, one character at a time.
For example, if the last command is dir, you must press F1 3 times because dir has 3 characters.
b) F2 – It pastes the command that was executed last at the command prompt, but it requires you to enter the character to which you want to paste the command.
For example, if the last command was to use ipconfig / displaydns and press F2, the command prompt would paste IPCONFIG / that is, it would paste all the characters before.
c) F3 – it pastes the last executed command (the entire command).
For example, if the last command is ipconfig / displaydns and you press F3, the command prompt will paste ipconfig / displaydns to the cursor position.
d) F4 – Displays a dialog asking the user to enter the character to be deleted.
Note: – When I press F4 in the Command Prompt window, it displays the above dialog, but it does not perform any tasks, no matter which character I type.
e) F5 – it pastes the last executed command. When pressed repeatedly, all executed commands are displayed in the reverse order of execution. Once the oldest command, the first command executed in the cmd session, has been displayed, pressing the F5 key does nothing.
f) F6 – Paste ^ Z to the command prompt.
g) F7 – Displays a navigation list of previously used commands in the form of a dialog box.
h) F8 – the command it has recently executed. Note that it is different from F5 because it keeps looping through the commands that were used before.
i) F9 – As mentioned above, the command prompt stores a list of all executed commands. This list is numbered from 0 to 9. When you press F9, you will be asked to enter the command number to use.
For example, to use the first command, type 0. To use the third command, type 2, and so on.
#9- Drag and drop files/folders into the command prompt
In #5 above, we mentioned how to use the auto-completion feature in the command prompt and avoid the hassle of entering the content location of the file/folder. Here we have something better. You can drag a file/folder into the Command Prompt window to paste its location into the Command Prompt window.
#10- Get detailed help on commands that don’t understand their syntax
This is one of those skills you can’t miss. Say, you don’t know what the syntax of the command dir is, or what tasks it performs. You can easily know all about the directory type help directory. Similarly, if you type help <command>, most commands will display their information.