The most commonly used prompt string is probably
$P$G, which results in a prompt like this:
However, with a little help from ANSI and some imagination, you can liven up your prompt.
You can use any string you like for a prompt, though long strings may prove to be quite impractical.
|Note:||ANSI is not available by default in 32-bit or 64-bit Windows, only in (DOS based) 16-bit Windows (95/98/ME).|
(ignored if redirected)
|$I||Info bar (OS/2)|
|$M||UNC name for current drive if remote (NT)|
|$R||Error level (OS/2)|
|$V||Operating system version|
|$X||Operating system revision level (OS/2 DOS prompt)|
|$+||A series of "+" signs corresponding to the number of pushed directories on the PUSHD stack (NT)|
It is options like $B, $L and $G that allow us to abuse the PROMPT command, as is shown in some extreme batch file examples.
PROMPT's $D and $T options can be utilized to store the week day, current date and current time in environment variables, independent of the operating system's language! See the Date/Time page to find out how this can be achieved.
PROMPT $E[0;1;33m$D$_ $T$H$H$H$H$H$H$E[31m [$P]$E[0m
The prompt command shown here will make your prompt look like this:
Sun 10/20/19 02:52 C:\>
PROMPT $V $X$_Errorlevel$Q$R$_[$P]
The prompt command shown here will make your OS/2 prompt look like this:
Operating System/2 version 4.00 Errorlevel=0 [C:\OS2]
An OS/2 DOS prompt, however, will look like this:
Operating System/2 version 4.00 Revision 9.30 Errorlevel=0 [C:\OS2]
PROMPT $E[s$E[1;1H$E[0;1;33;41m$E[K $P$G$E[1;54H$D $T$H$H$H$H$H$H$E[36;40m$E[u $P$G $E[37m
Depending on your browser settings the above line may not be shown as a single command line.
However, if you use this example in your AUTOEXEC.BAT, it should be typed as a single command line.
Also remember that DOS poses a 127 bytes limit on any command line, so don't overdo it.
The ANSI sequences in this example will do the following:
The result will be an "ordinary"
C:\> prompt in bright cyan at the normal position plus a red bar at the top of the screen, looking somewhat like this:
C:\> Sun 10/20/19 02:52 C:\>
page last uploaded: 2018-12-20, 10:49