Create a Custom Windows Command Prompt
The windows command prompt (command.exe) is a useful tool to perform various administrative tasks. The prompt is a string of characters (special and non special) that are displayed whenever the command prompt is waiting for input. Making the prompt less boring or more useful can make a lot of difference when working with the command prompt. It can be changed dynamically using the 'prompt' command, or permanently by creating a %prompt% user variable.
Contents
Steps
Changing the prompt dynamically
- Press windows + r.
- Type 'cmd' in the field and hit enter
- Type 'prompt', followed by the desired prompt string.
- The new prompt is displayed at the new line.
Note that this only changes the prompt of the current command prompt session, which is reset the next time you run the command prompt.
Changing the prompt permanently
- Right-click My Computer > Properties.
- Click on Advanced system settings.
- Click on Environment Variables
- Click New (under user variables).
- Type 'prompt' in the variable name field.
- Type the desired prompt string in the variable value field.
- Click OK on each opened dialog.
Tips
There are special character sequences that can be used in the prompt string to display different variables. The 'prompt /?' command displays a list of these special characters. Environmental variables can also be used in the prompt string, using the standard format % variablename%.
The default prompt is "$P$G" which simply means "Display the current drive and path ($P), followed by a ">" ($G). For example C:\Windows>. Following is the list of possible special characters.
$A & (Ampersand) $B | (pipe) $C ( (Left parenthesis) $D Current date $E Escape code (ASCII code 27) $F ) (Right parenthesis) $G > (greater-than sign) $H Backspace (erases previous character) $L < (less-than sign) $N Current drive $P Current drive and path $Q = (equal sign) $S (space) $T Current Time $V Windows version number $_ Carriage return and linefeed $$ $ (dollar sign)
If Command Extensions are enabled the PROMPT command supports the following additional formatting characters:
$+ zero or more plus sign (+) characters depending upon the depth of the PUSHD directory stack, one character for each level pushed.
$M Displays the remote name associated with the current drive letter or the empty string if current drive is not a network drive.
Warnings
- Avoid typing random gibberish in the command prompt. The Command Prompt is a powerful tool which can make permanent irreversible changes to your computer. It's quite possible to delete all the data on your computer!
Related Articles
- Change-Colours-in-Command-Prompt
- Use the Microsoft Batch File Language
- Change the Colour of Command Prompt Permanently
- Add a Profile Photo to Your User Account on Ubuntu
What links here
- Change Directories in Command Prompt
- Add an "Open Command Prompt Here As Administrator" Shortcut to the Context Menu in Windows 7 and Windows Vista
- Create the Matrix Rain in Command Prompt
- Force Windows Explorer to Start in the Folder You Want
- Use MS DOS
- Use the Microsoft Batch File Language
- Watch Movies Using Telnet