The Prompt command changes the Cmd.exe command prompt. If used without parameters, prompt resets the command prompt to the default setting, which is the current drive letter and directory followed by the greater than symbol (>). A command prompt (or just prompt) is a sequence of (one or more) characters used in the command-line interface to indicate readiness to accept commands. By using any of the set of character combinations listed belown the command-prompt can be modifiable by the user. Depending on the environment, a user may be able customize the command-prompt by changing the color, adding special character that may be conducive to their liking or perhaps adding the current time, all to make the prompt more informative or visually pleasing.
Syntax (view syntax formatting guide):
- Text: Specifies the text and information that you want to include in the command prompt.
- /?: Displays help at the command prompt.
You can customize the command prompt to display any text you want, including such information as the name of the current directory, the time and date, and the Microsoft Windows version number.
The following is a list of character combinations that you can include instead of, or in addition to, one or more character strings in the Text parameter. The list includes a brief description of the text or information that each character combination adds to your command prompt.
- $q: = (equal sign)
- $$: $ (dollar sign)
- $t: Current time
- $d: Current date
- $p: Current drive and path
- $v: Windows version number
- $n: Current drive
- $g: > (greater than sign)
- $l: < (less than sign)
- $b: | (pipe)
- $_: ENTER-LINEFEED
- $e: ANSI escape code (code 27)
- $h: Backspace (to delete a character that has been written to the command line)
- $a: & (ampersand)
- $c: ( (left parenthesis)
- $f: ) (right parenthesis)
- $s: space
NOTE: When command extensions are enabled (that is, the default) the prompt command supports the following formatting characters:
- $+: Zero or more plus sign (+) characters, depending on the depth of the pushd directory stack (one character for each level pushed).
- $m: The remote name associated with the current drive letter or the empty string if current drive is not a network drive.
NOTE: If you include the $p character in the text parameter, your disk is read after you enter each command (to determine the current drive and path). This can take extra time, especially for floppy disk drives.
Explanation with Examples
To set a two-line command prompt with the current time and date on the first line and the greater than sign on the next line, type:
The prompt is changed as follows, where the date and time are current:
Fri 06/01/2007 13:53:28.91
To set the command prompt to display as an arrow (–>), type:
To manually change the command prompt to the default setting (the current drive and path followed by the greater than sign), type: