Changes the Windows command prompt.
To change the command prompt:
|text||Any series of alphanumeric characters including the following special codes:
| $P|| Current drive and path
|| $E|| Escape code (ASCII code 27)|
| $N|| Current drive
|| $G|| >|
| $V|| Windows version number
|| $L|| <|
| $D|| Current date
|| $B|| ||
| $T|| Current time
|| $Q|| =|
| $_|| Carriage return and linefeed
|| $$|| $|
| $H|| Backspace (erases previous character)|
To reset the prompt to its default ($N$G):
- Apart from being a recognized command, PROMPT is also one of the "Standard" environmental variables (see SET). Issuing a PROMPT command is exactly equivalent to issuing a SET command for the environmental variable prompt. ie.
PROMPT $P$G is exactly equivalent to
When Win95 loads, it automatically sets the prompt environment variable to $P$G - ie. Current path and ">" - and this is the prompt that most users will consider the default and expect to see:
HOWEVER, Command.com's default is $N$G - ie. Current drive and ">".
This can cause some confusion with the unwary who might enter PROMPT (equivalent to resetting the environmental variable or entering: SET prompt= ) to reset the prompt after experimenting with different styles and wonder why they not only appear to have been returned to the root directory, but that CD seems not to work any more!
- The "$E" code is used with ANSI.SYS escape sequences. These can be used to significantly add to the potential for customising the prompt, change the screen colours, or even remap some of the keys (see "Examples" below)
- Although there is a limit of 128 characters for command line entries, long and complex prompts can be prepared by breaking the command into parts and assembling the whole using a series of PROMPT commands. Each instance of PROMPT (after the first) would include %prompt% - the environmental variable containing the current prompt string.
- If PROMPT is used with Ansi.sys via the $e special character, changing or resetting the prompt will not reset the Ansi.sys part unless done so explicitly. In other words, colour changes and key reassignments stay in effect until explicitly changed or Dos is closed. It is thus possible to use Prompt to reassign many keys using a series of PROMPT statements.
- As a reminder to occasional users of Dos in Win95, the following statement could be included in Autoexec.bat:
PROMPT Use Alt-Enter to switch from full screen to window$_$P$G
which would display as:
Use Alt-Enter to switch from full screen to window|
- Using the added enhancements available if ANSI.SYS is loaded, the above prompt can be modified so that the message remains at the top of the screen (As this coding is somewhat tortuous, I have prepared a breakdown):