You've come to this page because you've asked about command prompts.
This is the Frequently Given Answer to such questions.
A command prompt is the prompt that is displayed by a command interpreter. It is not a "DOS prompt".
A command prompt is displayed by the particular command interpreter that
one is running at the time. Many command interpreters use the value of
the PROMPT
environment variable to determine what they
display as a prompt. The value of the variable comprises literal
text interspersed with special codes that the command interpreter expands,
on the fly each time that it issues a prompt, to various strings. The
result, after expansion, is what is displayed as the prompt.
String | Substitution |
---|---|
$$ | The $ (dollar) character | $A or $a | The & (ampersand) character |
$B or $b | The | (bar) character |
$C or $c | The ( character |
$D | The date in standard ISO 8601 form | $d | The date in the current country's local form | $E or $e | The escape character (ASCII 27) | $F or $f | The ) character |
$G or $g | The > (greater than) character |
$H or $h | The backspace character (ASCII 8) | $I or $i | The help banner | $L or $l | The < (less than) character |
$M | The time in HH:MM form |
$m | The time in HH:MM:SS xm form (12-hour) |
$N or $n | The drive letter of the current drive | $P or $p | The current directory on the current drive | $Q or $q | The = (equals) character |
$R or $r | The return value of the most recent command | $S or $s | The space character (ASCII 32) | $T | The time in standard ISO 8601 form | $t | The time in the current country's local form | $U | The timezone as an offset from UTC | $u | The timezone name | $V or $v | The command interpreter and operating system version | $Xd or $xd | The current directory on the drive 'd' | $_ | A carriage return and line-feed |
There is significant variation in how command interpreters interpret the
value of the PROMPT
environment variable.
For example: Most of the (textual user interface) command interpreters
for OS/2, both the ones that are native OS/2 applications and the ones
that are DOS applications, understand the $I sequence, which
causes them to display a banner across the top of the console. This is
the banner that IBM's 16-bit CMD displays, for example:
OS/2 Ctrl+Esc = Window List Type HELP = help
[C:\]
However, this banner it isn't displayed by graphical user interface command interpreters on OS/2, and the $I string is not understood at all by any command interpreters for Windows NT.
In the absence of that environment variable, command interpreters display a default prompt. This also varies from command interpreter to command interpreter. These are the default prompts for several command interpreters:
The default COMMAND prompt (IBM's COMMAND for OS/2 and the various
PC/MS/DR-DOS COMMANDs) is equivalent to the PROMPT
variable
value $N$G:
C>
The default CMD prompt (IBM's 16-bit CMD and the CMD from the
32-bit Command Interpreter)
is equivalent to the PROMPT
variable value [$P]:
[C:\OS2\Help]
The default 4DOS, 4NT, and TakeCommand/Win32 prompt is equivalent to the
PROMPT
variable value $p$g (note the lowercase):
c:\os2\help>
The default 4OS2 prompt is equivalent to the PROMPT
variable
value [$p] (note the lowercase):
[c:\os2\help]