PROMPT – Windows CMD Command


Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Change the cmd.exe command prompt.

The default prompt is $P$G (drive/path followed by > )

The PROMPT command is tied to the %PROMPT% environment variable, editing the variable will lead to the same result as using the PROMPT command (e.g. PROMPT $P$G is the same as SET PROMPT=$P$G)

If the %PROMPT% variable is deleted, the prompt will automatically revert to the default.

To set the CMD prompt for all sessions, set a permanent environment variable (SETX) with the appropriate prompt text. e.g.
SETX PROMPT $M$_$P$G

The prompt variable only holds the prompt definition, the final prompt characters are calculated by the CMD console.

The maximum length of a prompt string is 511 characters. If a longer prompt is set it will be silently truncated to the first 511 symbols.
The dollar codes each count as 1 character.

Errorlevels

When CMD Command Extensions are enabled (the default)

If the prompt was successfully changed %ERRORLEVEL% = unchanged, typically this will be 0 but if a previous command set an errorlevel, that will be preserved (this is a bug).

If prompt could not be changed %ERRORLEVEL% = 1

If an attempt is made to set a prompt using a dollar sign followed by any character, not in the list of codes above, then everything after that dollar sign will be ignored.

PROMPT does not error if passed invalid switches PROMPT /Z /invalid – it will just set them as part of the prompt.

You may also like...

2 Responses

  1. froleprotrem says:

    I am so happy to read this. This is the kind of manual that needs to be given and not the accidental misinformation that’s at the other blogs. Appreciate your sharing this greatest doc.

  2. zortilonrel says:

    Very nice info and right to the point. I don’t know if this is in fact the best place to ask but do you people have any thoughts on where to employ some professional writers? Thank you 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *