Share via


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:

prompt time is: $t$_date is: $d

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

Cmd

Command-line reference A-Z