Home > Commands N-Z > Commands P

PROMPT


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Changes the appearance of the command prompt.

You can customize the command prompt to display any text you want, including such information as the name of the current directory, the time and date, and the operating system version number.


Syntax

PROMPT [text]


Parameters
text (v2.0 Win95 NT3.5)
Specifies any text and information you want included in your system prompt.
The list shows the character combinations you can include instead of, or in addition to, any character string(s) in the text parameter. The list includes a brief description of the text or information that each character combination adds to your command prompt. Caution Depending on if DOSKEY is loaded or not, the output can be unreadable.

Switches

none.


Related

For information about setting the current date and time, see the DATE and TIME commands.
For information about ANSI escape sequences, see ANSI.SYS.
SETX - Set an environment variable permanently.
Equivalent Linux BASH commands:
The BASH prompt is set by the BASH variable $PROMPT_COMMAND.
env - Display, set, or remove environment variables.
export - Set an environment variable.


Notes
Using the PROMPT command without the text parameter

When you use the PROMPT command without specifying a value for text, PROMPT resets the command prompt to the default setting--the current drive letter followed by a greater-than sign (>).


Using the $P value for text

If you include the $P character in the text parameter, the operating system reads your disk after you enter each command to determine the current drive and path. This can take extra time, especially for floppy disk drives.


Defining the DOS command prompt in Windows

If you use Win3.1, you can change the command prompt with the %WINPMT% environment variable.

For example, suppose you want the message to precede the operating system command prompt:

Type "exit" when you're ready to return to Windows.

To display this message, include the command to your AUTOEXEC.BAT file:

    SET winpmt=Type "exit" when you're ready to return to Windows.$_$p$g

Examples

This example sets the command prompt to display the current drive and path followed by the greater-than sign (>), the default setting:

    PROMPT $p$g

This command displays a two-line prompt in which the current time appears on the first line and the current date appears on the second line:

    PROMPT time is: $t$_date is: $d

If your CONFIG.SYS file loads ANSI.SYS, you can use ANSI escape sequences in your prompts. Displays your prompt in reverse video mode and returns to usual video mode for other text:

    PROMPT $e[7m$n:$e[m

The characters following the escape code ($E) are ANSI escape sequences.


Errorlevels

none.


Availability
Internal
DOS
v2.0 v2.01 v2.05 v2.10 v2.11 v2.11R v2.12 v2.2 v2.25 v3.0 v3.20 v3.05 v3.1 v3.21 v3.25 v3.30 v3.3A v3.3R v3.3T v3.31 v3.40 v4.0 v4.01 v4.01A v5.0 v5.0A v5.00.02 v5.001A v5.01 v5.02 v6.0 v6.10 v6.2 v6.21 v6.22 v6.23 v7.00 v7.0R1 v7.10 v8.00
Windows
Win95 Win98 WinME
Windows NT
NT3.5 NT4 NT2000 NTXP NT2003