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.
Textcan 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$gSpecify the drive and directory on one line and the date, followed by
the greater-than sign (>) on another:
C:\>prompt $p$_$d$gSpecify the drive only, followed by the greater-than sign
(>), which was the default prompt on early
versions of DOS:
C:\>prompt $n$gNotes
The current prompt setting is actually stored in the environment, and
the prompt command is merely a shortcut for the
following:
set prompt=$p$gSee 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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access