The PROMPT command in Windows Command-Line (CMD) is useful for customizing the appearance of the command prompt window. This command enables users to tailor the command-line prompt to display various useful information or to set a specific aesthetic. It’s particularly valuable in environments where distinguishing between multiple command windows based on current directory or other context is necessary.


The basic syntax for the PROMPT command is as follows:

PROMPT [text]

text can include plain text combined with specific codes that insert dynamic data (such as the current directory). If no text is specified, the command prompt resets to the default setting ($P$G).


Here are the special codes that can be used within the text to insert special data:

  • $A — Represents an ampersand (&)
  • $B — Represents a pipe (|)
  • $C — Represents a parenthesis (()
  • $D — Displays the current date.
  • $E — An escape code (ASCII code 27).
  • $F — Represents a closing parenthesis ())
  • $G — Greater-than sign (>)
  • $H — Backspace (erases the previous character).
  • $L — Less-than sign (<)
  • $N — Current drive.
  • $P — Current drive and path.
  • $Q — Equals sign (=)
  • $S — Space.
  • $T — Current time.
  • $V — Windows version number.
  • $_ — Carriage return and linefeed.
  • $$ — Dollar sign ($)


  1. Set a simple prompt showing the current directory followed by a greater-than symbol:
  2. Display the current date and time in the prompt:
    PROMPT $D $T$G
  3. Create a complex prompt showing user-specific information, date, and path:
    PROMPT [User: $L$N$G] - $P$_$D $_$T$G$_Ready$G 

Common Issues

  • Error when using special characters: Ensure special characters are escaped properly, such as $$ for a single dollar sign.
  • Prompt resets on reboot: Changes made by PROMPT are not permanent and will reset when the CMD session ends. To make changes persist, set the PROMPT command in your system environment variables or include it in scripts.


The PROMPT command can be particularly powerful when combined with batch scripts to set dynamic command prompts based on the script’s context. Here’s an example of combining PROMPT with CD in a script:

CD C:\Work

This changes the directory to C:\Work and updates the prompt to reflect the new working directory context, helping the user recognize the active directory.

  • CD (Change Directory): Often used in conjunction with PROMPT to show the current directory.
  • SET and ECHO: Useful for customizing and displaying environment variables in the prompt.

For more detailed information, you can visit the official Microsoft documentation page.