System command

doskey command

Create command macros or display the current command history.

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

doskey [/reinstall] [/listsize=<size>] [/macros:[all | <exename>] [/history] [/insert | /overstrike] [/exename=<exename>] [/macrofile=<filename>] [<macroname>=[<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 commands entered in the current Command Prompt session.

doskey /history

Parameters, options and clauses

doskey options and parameter descriptions
Option / clauseDescription
<name>=<macro>Create or replace a command macro in the current session.
/macros[:all]Display defined macros.
/historyDisplay the current command history.
/macrofile=<file>Load macros from a file.
/reinstallReinstall Doskey in the current command session.
/listsize=<size>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/macros:<exename>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/insertMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
/overstrikeMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
/exename=<exename>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/macrofile=<filename>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
<macroname>=[<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.
KeyMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
UP ARROWMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
DOWN ARROWMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
PAGE UPMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
PAGE DOWNMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
Key or key combinationMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
LEFT ARROWMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
RIGHT ARROWMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
CTRL+LEFT ARROWMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
CTRL+RIGHT ARROWMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
HOMEMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
ENDMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
ESCMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
F1Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
F2Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
F3Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
F4Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
F5Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
F6Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
F7Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
ALT+F7Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
F8Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
F9Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
ALT+F10Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
CharacterMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$G or $gMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$G$G or $g$gMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$L or $lMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$B or $bMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
$T or $tMicrosoft 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.
$1 through $9Microsoft 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.
<exename>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<macroname>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<text>Microsoft 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