Windows 11 comes with an upgraded console app called Windows Terminal. It is a packaged app to use command line interface with PowerShell, Command Prompt or Azure Cloud Shell. However, traditionally users are convenient with Command Prompt and continue to use the tool instead of PowerShell or Terminal. If you love Command Prompt, here are some tricks to improve your productivity.
Command Prompt in Windows
In our earlier article, we have explained how to open Command Prompt in Windows 11 using eight different ways. Windows search shows frequently used apps when you hover over the search icon on taskbar as well as when you click on the search icon. If you are frequently opening Command Prompt, then the easiest way is to use the search and open Command Prompt app.
Note that cmd.exe is the application name of Command Prompt in Windows which you can find under C:\Windows\System32. Therefore, you can type cmd in the search box to find Command Prompt app.
1. Customize Font, Layouts and Colors of Command Prompt Interface
By default, Command Prompt opens in black background with fixed window size. Generally, Windows OS will remember the size of app window when you resize it manually. However, it does not work for Command Prompt and you will see the app opens with same height/width regardless of whether you resized it or not. What you can do is to set your preferred size, font and layout colors to customize the app as per your need.
To do that, right click on the Command Prompt title and select “Properties” option.
This will open Command Prompt properties with multiple tabs.
You can customize the followings by navigating to different sections in the properties window:
- Options – under this section, you can change the text selection, edit options, set cursor size, command history buffer and choose to delete duplicate commands from history buffer.
- Font – here you can change the default font size and family to use in Command Prompt app.
- Layout – change the default Command Prompt app window height and width sizes as per your need.
- Colors – set the text and background colors and adjust opacity.
- Terminal – setup separate colors for terminal.
After changing the colors and font size, here is how the customize Command Prompt will look like.
Note: Title bar color of Command Prompt and other apps depends on the system’s accent color set under “Settings > Personalization > Colors”. Make sure to enable “Show accent color on title bars and windows borders” option to change the title bar color. Learn more on how to customize accent colors in Windows.
2. Command Prompt Text and Title
By default, Command Prompt will show the app name on its title bar and show C:\ as a prompt. Use the following commands to change the title bar text and prompt:
title My Command Line Interface
prompt My Prompt
It will look like below in Command Prompt app.
Remember, unlike changing properties both title and prompt and temporary and will show only on the current session. It will go back to defaults when you close and reopen Command Prompt.
3. Terminate Commands with Control + C
Some commands will run for long time without an option to terminate it. For example, ping command may run longtime depending upon the hostname. You can also find this problem with dir which will try to list down all the directories. Simple trick is to press “Control + C” shortcut keys to terminate the running command instantly. You can see Control-C and ^C in Command Prompt indicating the running command was terminated by user.
4. Open Command Prompt as Admin
Most Windows commands need administrator access to work from Command Prompt. If you are the administrator, then it is a clever idea to create a desktop shortcut for Command Prompt and set to open with admin privilege.
- Go to “C:\Windows\System32” location in File Explorer to find cmd application. This is the application file name for Command Prompt app.
- Right click on it and select “Show more options” (only on Windows 11, otherwise you will see the expanded menu).
- When you see the expanded context menu, select “Send to > Desktop (create shortcut)” option.
- This will create a shortcut for Command Prompt app in your desktop. Right click on it and select “Properties” option.
- When you are in the properties window, go to “Shortcut” tab and click on “Advanced…” button.
- On the “Advanced Properties” pop-up, select “Run as administrator” checkbox.
- Press “OK” to close advanced properties pop-up and then click “OK” on the properties pop-up to save your changes.
You can pin the desktop shortcut to start menu or taskbar and quickly open Command Prompt in admin mode.
5. Function Keys for Command Prompt
Function keys on your keyboard have different function when working with Command Prompt. You can make use of these key for the following purposes:
|Command Prompt Function
|Insert previous command letter by letter
|It will open a pop-up asking you to enter the character from the previous command. Then it will paste the previous command up to the entered character. Let us say, your previous command is ping. You can press F2 and then enter g to insert pin (before the letter g in ping command).
|Insert previous command
|Delete the command up to the entered character
|Insert past command from history till first executed command
|Insert ^Z in the prompt
|Shows a history list of previously executed command. You can use up or down arrow and press enter to select the desired command from the list.
|Cycle through previously executed command history
|Shows a pop-up to enter a number of command to run from the F7 history list
|Toggle full screen mode on or off
Here is an example of a pop-up showing with list of previously executed commands in Command Prompt app when pressing F7 key.
Note that on some computer models, you need to turn on Fn key to use function keys. Otherwise, it will do different functions as assigned by the manufacturer.
6. View Tree Structure of Folders
Ever wonder how to view structured tree map of a folder in your computer. Simply go to the folder name and enter tree command to see the list in Command Prompt.
Make sure you are not running tree command on the large folder or at the C: level. If you have wrongly executed the command which runs for long time, then press “Control + C” to terminate without waiting for it to complete.
7. Quickly Access Command History with Arrows
Like function keys, you can also use arrow keys as shortcuts in Command Prompt.
- Up arrow – insert previous command from the history
- Down arrow – insert next command from the history
- Right arrow – insert last command character by character
8. Use Tab Completion for Prediction
This is a wonderful Command Prompt trick to find the folder names if you forgot it. For example, you want to find the directory list of a folder in C: but forgot the correct folder name. In this case, when you are in C: prompt type dir and press space key. Now, press tab to go through all the folder names one by one from alphabetical order. When you find the correct folder name, simply press enter key to run dir command. Similarly, you can use “Shift + Tab” to see the folder names in the reverse order (last folder name in alphabetical order will show first). You can use this trick, if you remember the folder starts with letter W or Z, but do not know the exact name.
9. Copy Paste or Drag and Drop
Do you know that you can drag and drop the file in Command Prompt to insert its full path? Most commands need the full path to enter in Command Prompt which may be inconvenient when the path is too long. What you can do is to find the file in File Explorer and simply drag and drop in in the Command Prompt which will insert the full file path. This is extremely useful when you want to run executable application files from Command Prompt. For example, you can go to “C:\Windows\System32” in File Explorer, drag regedt32 application file and drop in Command Prompt. Now, you will see the full path is inserted like C:\Windows\System32\regedt32.exe and press enter to open Registry Editor app.
10. Getting Help on Commands
Most Windows commands are evolved from their predecessors of MS-DOS commands. However, there are also some new commands and some old DOS commands will no more in latest Windows version. So, it is common to forget the syntax of a command when you want to run. If you are stuck with any command syntax, simply enter the command name with /? To get the complete help details. Command Prompt will show you the help page by page with “Press any key to continue…” message after each page. For example, type break/? and press enter key to get help on break command. You can find this command is from old DOS system and not effective in Windows.
Instead of using /? Prefix, you can also use the help command to details of any Windows command. In the above case, you can type help break to get the details of break command.
Note that simply entering help and pressing enter will show the details of all available Windows commands in Command Prompt.
Command Prompt is an unavoidable app in Windows computers to get things done quickly. Whether you want to find the IP address of your computer or get the tree view of a folder, you can do it in few seconds with Command Prompt app. Knowing the above Command Prompt tricks can help you to improve the productivity and save lot of time.