System command

prompt command

Set the text and tokens displayed by the command prompt.

Availability: Microsoft Learn command reference spanning Windows client and Windows Server releases; some entries are legacy, role-specific, optional-feature or interactive subcommands.中文

Documented syntax

prompt [<text>]

The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.

Examples

Show the current path followed by the command prompt character.

prompt $P$G

Parameters, options and clauses

prompt options and parameter descriptions
Option / clauseDescription
<promptText>Set prompt text; tokens such as $P (path) and $G (>) are expanded.
No argumentRestore the default prompt format.
<text>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
/?Display command help or the supported command-line usage.
CharacterMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$qMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$$Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
$tMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$dMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$pMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$vMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$nMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$gMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$lMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$bMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$_Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
$eMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$hMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$aMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$cMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$fMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$sMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory