Prompt

Prompt

Changes the Cmd.exe prompt. Used without parameters, prompt resets the command prompt to the default setting, the current drive letter followed by the current directory and a greater-than symbol (>).

Syntax

prompt [Text]

Parameters

Text

Specifies any text and information you want included in your system prompt.

/?

Displays help at the command prompt.

Remarks

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 Windows XP version number.

The following table lists the character combinations you can include instead of, or in addition to, one or more character strings in the Text command-line option. The list includes a brief description of the text or information that each character combination adds to your command prompt.

Character

Description

$q

= (equal sign)

$$

$ (dollar sign)

$t

Current time

$d

Current date

$p

Current drive and path

$v

Windows XP version number

$n

Current drive

$g

> (greater-than sign)

$l

< (less-than sign)

$b

| (pipe)

$_

ENTER-LINEFEED

$e

ANSI escape code (code 27)

$h

Backspace (to delete a character that has been written to the prompt command line)

$a

& (ampersand)

$c

( (left parenthesis)

$f

) (right parenthesis)

$s

space

When command extensions are enabled (that is, the default) the prompt command supports the formatting characters listed in the following table.

Character

Description

$+

Zero or more plus sign (+) characters depending upon the depth of the pushd directory stack, one character for each level pushed.

$m

The remote name associated with the current drive letter or the empty string if current drive is not a network drive.

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

Examples

The following example sets the command prompt to display the current drive and path followed by the greater-than symbol (>):

prompt $p$g

The following 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: