The command: "PROMPT" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available
The examples for the command "PROMPT"
It seems like there is a typo in the term
"PROMP" and you probably mean
"PROMPT". The
`PROMPT` command in the Windows Command Prompt is used to change the appearance of the command line (prompt). Here are some examples of using the
`PROMPT` command:
Example 1: Restore default prompt:
PROMPT $P$G
Description: This command restores the default prompt with path and
`>` symbol.
Example 2: Custom prompt without path:
PROMPT $G
Description: This sets a custom prompt without a path, just the
`>` symbol.
Example 3: Display current date in prompt:
PROMPT $D $T$_$P$G
Description: This command displays the current date, time and path in the prompt.
Example 4: Customization of the prompt with text:
PROMPT Please enter a command: $G
Description: Here the prompt is customized with a custom text (
"Please enter a command:") and the
`>` symbol.
Example 5: No path displayed in the prompt:
PROMPT $$ $G
Description: This command only displays the
`>` symbol, without the current path.
Example 6: Displaying the user name in the prompt:
PROMPT $E[32m$P$_$E[34m$G$E[0m
Description: This example uses ANSI color sequences (
`$E[32m` for green,
`$E[34m` for blue) and displays the username, path and
`>` symbol in the prompt.
Note: The individual parts in the
`PROMPT` command are special placeholders:
-
`$P`: Current path.
-
`$G`:
`>` symbol for the command line.
-
`$D`: Current date.
-
`$T`: Current time.
-
`$E[...]`: ANSI color sequences.
You can mix and match these placeholders to design the prompt the way you want. Note that the exact functionality of the
`PROMPT` command depends on the version of the command prompt and the operating system.
"PROMPT" Excerpt from Microsoft Windows Help
Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.
C:\\WINDOWS>
Changes the cmd.exe command prompt.
PROMPT [text]
text Specifies a new command prompt.
Prompt 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)
$N Current drive
$P Current drive and path
$Q = (equal sign)
$S (space)
$T Current time
$V Windows XP version number
$_ Carriage return and linefeed
$$ $ (dollar sign)
If Command Extensions are enabled the PROMPT command supports
the following additional formatting characters:
$+ zero or more plus sign (+) characters depending upon the
depth of the PUSHD directory stack, one character for each
level pushed.
$M Displays the remote name associated with the current drive
letter or the empty string if current drive is not a network
drive.
Important information, tips for the "PROMPT" command
There are a few important points to note when using the
`PROMPT` command in the Windows Command Prompt:
1.
Availability of ANSI color sequences: The
`PROMPT` command in newer versions of Windows supports ANSI color sequences, which enable colors and formatting in the prompt. Note that this is not supported in all versions and terminals.
2.
Customize Prompt Placeholders: You can use different placeholders in the
`PROMPT` command to customize the prompt as you wish. Some common wildcards are
`$P` for the current path,
`$G` for the
`>` symbol, and
`$D` for the current date.
3.
Issues with Prompts Too Long: A prompt that is too long can make the command line difficult to read, especially if the path is very long. Make sure that the customized prompt does not affect readability.
4.
Wildcards in ANSI Color Sequences: If you use ANSI color sequences in your prompt, make sure the escape sequences are properly closed to prevent the command line from rendering incorrectly.
5.
Admin Rights: Some changes to the prompt require administrator rights. If you're having trouble changing the prompt, try opening Command Prompt as an administrator.
6.
Wildcard combinations: You can combine different wildcards to make the prompt more detailed. Experiment with different combinations to create the best prompt for you.
Here are some examples that take the above points into account:
-
Restore default prompt:
PROMPT $P$G
-
Display current date in prompt:
PROMPT $D $G
-
Custom prompt with ANSI color sequences:
PROMPT $E[32m$P$_$E[34m$G$E[0m
Make sure the changes you make to the prompt improve readability and usability, and consider feature support depending on the exact version of the prompt and terminal you're using.