The Command Prompt, also referred to as Command-Line or CMD, is a text-based program used to issue commands to your computer operating system. Prior to a development of an operating system with a graphical interface (such as Windows) where you interact with it with mouse clicks, the Command Prompt (aka DOS prompt) was the primary means to use a computer. It involved typing command in the proper syntax to get a computer to perform various task - such as copying a file, re-naming a file, or launch a program.
Today, the Command Prompt is a useful tool used typically by system administrators, help desk technician or similar to troubleshooting or administer a system. The Command Prompt typically provides a less abstracted interaction with the operating system and provides greater functionality and efficiency over a graphical interface.
This article goes overs some tips and tricks to help you customize your Command Prompt for a better experience. These commands shown here are tested on Windows 10 but most will work in other versions of Windows as well. In the article, we will cover the following:
- How to Open Command Prompt
- Customize the Prompt
- Customize the Title Bar
- Change Background and Text Color
- Running Multiple Command on the Same Line
- Clear the Screen (cls)
- Copying Text from Command Prompt Window
- How to Make Your Customization the Default
- Forcibly Terminate Any Command Mid-Operation
- Drag And Drop Folders to "Paste" its Directory Path
- Shutdown Your Computer with a Timer
- Recommended Reading
To use this utility, you will need to launch the Command Prompt window. The three common ways to launch the Command Prompt window are:
- Search for
cmdusing the built-in Windows search tool.
- Right-click on the Start icon and select Command Prompt.
- Press the keyboard combination WinKey + R, then type
cmdat the Run window that appears.
The default prompt can be customize to show a variety of information. For some, your default prompt may look like the one illustrated below.
If you work in the command window often, you may find it useful if the prompt include other information such as the current time and folder path. To see a list of available options, bring up the help page by typing in the following then pressing Enter,
prompt /?. A help page like the one illustrated below appears to shows you a list of available options.
To change your prompt to include the current timestamp and the current drive letter and folder path, type the following and press Enter:
prompt $T $B $P$G
As shown in the help page, the $T signifies the current timestamp, the $B is the pipe symbol (vertical line). It's purpose here to is serve as a visual divider. The $P signifies the current drive letter and folder path. Finally, the $G is the greater-than symbol and it is used as a visual aid to the user that they what they type will appear to the right of this symbol.
You can even include your own text in the prompt. For example, to change your prompt to read Death Star, type
prompt Death Star$G then press Enter.
To reset your Command Prompt to your computer's default, type in
prompt then press Enter
The command window title bar, illustrated below, can also be customized with your own text.
Example of Custom Title Bar
As an example, to change your Command Prompt title bar to read Death Star Console, type in
title Death Star Console then press Enter
You should see your title bar change as illustrated below.
Back to Top
The background color and the text color can be changed to a handful of color combinations. To see a list of available colors, type in
color /? then press Enter
As shown on the help page, there are 16 colors to choose from for both your background and text color. It should be noted that you will not be able to change both your background and text to the same color. As an example, to change the background to green and the text to black, type in
color 20 then press Enter. The first digit (2 in this example) sets the background to green. The second digit (0 in this example), sets the text color to black.
To reset your Command Prompt colors to your computer's default, type in
color then press Enter.
If you have a series of commands to run, you can string them together on the same line to execute them, as oppose to typing in one command per line. To do this, all you need is to is type
&& between each of your commands. For example, to change the title bar to read Death Star Console and text color to green, type in the following then press Enter:
title Death Star Console && color 2
Back to Top
Copying text from a Command Prompt Window isn't the same as copying text from a Word document. Follow the steps below to copy text from Command Prompt Window.
- Right-click anywhere on the Command Prompt Window.
- Select Mark from the popup menu, as illustrated below.
- Click and hold the left mouse button to highlight the text area you want to copy, as illustrated below.
- Press Enter on your keyboard. Your highlighted text is now copied to the Windows clipboard. You can now open Notepad, Microsoft Word or almost any other application where you can then paste your text into.
If you want to clear your Command Prompt window of previous commands you've typed in, type in
cls then press Enter.
Your Command Prompt windows will be cleared as illustrated below.
Back to Top
The customization described in this article are all temporary. Once you close the Command Prompt window, your changes are lost. The next time you launch Command Prompt, all your customization are reverted back to their default settings. To make your specific customization the default so that it always show when you launch Command Prompt, you will need to make a registry edit.
Incorrect changes to registry settings can cause serious system problems that may be irreversible without reinstalling the operating system. You must back up your registry before making any registry changes. We are not responsible for damage resulting from incorrect use of the Registry Editor.
- Press the keyboard combination WinKey + R to open the Run window.
regeditthen press Enter.
- When the Registry Editor window appears, navigate to
- On the right pane, right-click on an empty space and select New > String Value.
- Name this as Autorun.
- Right-click on this Autorun and select Modify.
- In the Edit String dialog box, enter your customization in the Value Data text box in the same manner as described above. Using the examples above, to change the title bar to read Death Star Console, the prompt to read Death Star, and the text color to green, type in
title Death Star Console && prompt Death Star$G && color 4then press OK.
- Exit Registry Editor. Your customization are now set as default. Each time you launch Command Prompt, the customization you've defined here will be applied.
If you no longer want the customizations you've defined in the registry, you can revert back to your Windows default by deleting the Autorun key created in the previous step.Back to Top
Press CTRL + C aborts the current running task.Back to Top
When you need to provide a directory or folder path to a command, instead of typing it, you can do so more efficiently and accurately by dragging and dropping the file or folder from your File Explorer to your Command Prompt window.
The in illustration below, right-click and hold on the file named "host", dragging it to your Command Prompt window, and then release the mouse button will automatic insert the location path to the file. In this example, the file path automatically inserted in the Command Prompt window is "C:Windows\Systems\drivers\etc\hosts"
Back to Top
A shutdown command is available that is used to either shutdown and restart a computer, along with other available actions. For example, to shutdown your computer automatically in one hour, type in your Command Prompt window
shutdown /s /t 1800 then press Enter. The
/s option is to specify a shutdown (as oppose to a restart with the /r option). The
/t option is to specify the shutdown is to occur using a timer. And in this case, the timer is set to 1800 seconds (or 30 minutes).
If you cancel a scheduled shutdown, you can abort it by typing the command
shutdown /a then press Enter.
Improve confidence and job performance
Improve productivity and efficiency
An investment in knowledge always pays the best interest.