fortypoundhead.com

PROMPT

Posted On 2007-04-24 by FortyPoundHead
Keywords: Command Reference
Tags: Windows Commandline Windows
Views: 1578


Change the cmd.exe command prompt.

Syntax
PROMPT [text]

Key
text : a text string.The prompt text can be made up of normal characters and the following special codes:

$A & (Ampersand)
$B | (pipe)
$C ( (Left parenthesis)
$D Current date
$E Escape code (ASCII code 27)
$F ) (Right parenthesis)
$G > (greater-than sign)
$H Backspace (erases previous character)
$L < (less-than sign) $M Display the remote name for Network drives
$N Current drive
$P Current drive and path
$Q = (equal sign)
$S (space)
$T Current time
$V Windows NT version number
$_ Carriage return and linefeed $$ $ (dollar sign) $+ Will display plus signs (+) one for each level of the PUSHD directory stackExamples

Display the UNC path whenever you are using a network drive (mapped with NET USE)
PROMPT $M$_$P$G

Simulate an HP-UX prompt with the computername and the current folder on separate lines:
PROMPT=$p$_%username%@%computername%:.

Restore the default prompt:
PROMPT $P$G

PROMPT is implemented as a hidden NT environment variable called PROMPT,
try doing:

ECHO %prompt%

knowing this you can force a permanent change in the CMD prompt for all sessions by setting a permanent environment variable with the appropriate prompt text.
e.g. SETX PROMPT $M$_$P$G

You can also create specific shortcut''s to the command prompt like this:
CMD /K PROMPT $M$_$P$G

If Command Extensions are disabled the commands $M and $+ are not supported.


About the Author

FortyPoundHead has posted a total of 1974 articles.

 


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.224.13.210

Before you can post, you need to prove you are human. If you log in, this test goes away.




Recent Forum Posts

Advanced search added
dwirch posted on September 23, 2017 at about 13:44 in Site News

Job Spammer: Gaurav Mehta - AgreeYa Solutions
dwirch posted on September 22, 2017 at about 10:35 in Spammers

Job Spammer: Prutha Siri - Javelin Systems
dwirch posted on September 10, 2017 at about 6:15 in Spammers

New security implemented
dwirch posted on September 7, 2017 at about 7:16 in Site News

Malicious IP Checker Companion Tool
dwirch posted on August 12, 2017 at about 20:24 in Site News

Job Spammer: Steve Adams
dwirch posted on August 8, 2017 at about 7:44 in Spammers