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 stack
Display the UNC path whenever you are using a network drive (mapped with NET USE)
Simulate an HP-UX style prompt with the computername and the current folder on separate lines:
Display the time, backspacing to hide the milliseconds:
Restore the default prompt:
PROMPT is implemented as a hidden* environment variable called PROMPT: ECHO %prompt%
Knowing this you can force an over-ride of 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 a shortcut to the command prompt like this:
CMD /K PROMPT $M$_$P$G
* In fact the prompt variable is a property of the CMD console, it's not available to Windows Explorer or any other applications, so strictly speaking is not an environment variable.
PROMPT is an internal command. If Command Extensions are disabled the commands $M and $+ are not supported.
“All actions are judged by the motive prompting them” ~ Muhammad
SETX - Set an environment variable permanently.
Powershell: Create a function called Prompt (save in Profile.ps1 to make permanent)
Equivalent bash command (Linux): variable $PROMPT_COMMAND