Name
prompt
Synopsis
Change the appearance of the prompt.
Syntax
prompt [text
]
Description
Type prompt
by itself (without
text
) to reset the prompt to its default
setting.
The prompt
options are:
-
text
Specifies a new command prompt.
Text
can contain normal characters and the following special codes:-
$_
Carriage return and linefeed
-
$$
Dollar sign (
$
)-
$a
Ampersand (
&
)-
$b
Pipe (
|
)-
$c
Left parenthesis (
(
)-
$d
Current date
-
$e
Escape character (ASCII code 27)—used to provide extended formatting
-
$f
Right parenthesis (
)
)-
$g
Greater-than sign (
>
), commonly known as the caret-
$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 version number
Examples
Specify the current drive and directory followed by the greater-than
sign (>
)—the default prompt in Windows
XP:
C:\>prompt $p$g
Specify the drive and directory on one line and the date, followed by
the greater-than sign (>
) on another:
C:\>prompt $p$_$d$g
Specify the drive only, followed by the greater-than sign
(>
), which was the default prompt on early
versions of DOS:
C:\>prompt $n$g
Notes
The current prompt setting is actually stored in the environment, and
the prompt
command is merely a shortcut for the
following:
set prompt=$p$g
See “set”, later in this chapter, for more information environment variables and details on setting global environment variables that don’t expire when the Command Prompt window is closed.
Get Windows XP in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.