How to Use the PROMPT Command in MS-DOS 6.22
In MS-DOS 6.22, the PROMPT command is an internal
command used to customize the command line interface's appearance. By
default, MS-DOS typically displays only the current drive letter
followed by a greater-than symbol (such as C>), but the
PROMPT command allows users to incorporate system
information, path details, formatting characters, and ANSI escape
sequences directly into the prompt text.
Basic Syntax and Operation
The basic syntax for the command is:
PROMPT [text]
Entering the command without any parameters resets the prompt to the
default drive letter and greater-than sign (C>). If
plain text is provided, MS-DOS replaces the prompt with that literal
text. To include dynamic system information or characters that cannot be
typed directly, special two-character codes preceded by a dollar sign
($) are used.
Core Special Codes
MS-DOS 6.22 recognizes a specific set of codes that inject dynamic data or structural formatting into the command line:
$P: Displays the current drive and working directory path.$G: Inserts the greater-than symbol (>).$N: Displays the current drive letter without the full path.$D: Outputs the current system date.$T: Outputs the current system time.$V: Displays the MS-DOS version number.$_: Generates a carriage return and line feed, allowing multi-line prompts.$B: Inserts the pipe character (|).$Q: Inserts an equal sign (=).$$: Inserts a literal dollar sign ($).$H: Acts as a backspace, useful for deleting trailing seconds or characters from output like time.
Common Implementation Examples
The most widely adopted prompt in MS-DOS 6.22 displays the current working path followed by a greater-than sign:
PROMPT $P$G
This produces an interface like C:\DOS>.
To create a multi-line prompt that displays the current date, time, and working directory on separate lines:
PROMPT $D $T$_$P$G
Advanced Styling with ANSI.SYS
The PROMPT command also supports the $E
code, which represents the ASCII escape character (code 27). When the
ANSI.SYS device driver is loaded in
CONFIG.SYS, the $E code can send terminal
control sequences to change screen colors, text attributes, and cursor
positions directly through the prompt.
For example, the following command creates a colored prompt (bright
white text on blue) if ANSI.SYS is loaded:
PROMPT $E[1;37;44m$P$G$E[0m
The $E[0m string at the end resets the text attributes
to default so user-typed commands remain standard.
Making Changes Permanent
Any modifications made by typing PROMPT directly into
the command line last only for the current session. To ensure that
custom prompts load automatically when the computer boots, the desired
PROMPT command must be added to the
C:\AUTOEXEC.BAT configuration file.