doskey
Windows CMD · Terminal · reference only
What it does
Manages the console command history and creates macros: shortcuts that expand into full commands.
Syntax
doskey [opciones] [macro=orden]
Options and parameters
macro=ordenDefines a macro; $* in the command is replaced by the arguments.
/historyShows the history of commands typed in the console.
/macrosShows the defined macros.
/listsize=NChanges the number of commands kept in the history.
/macrofile=ficheroLoads macros from a file.
/reinstallInstalls a new copy of doskey and clears the history.
Usage examples
doskey ls=dir $*Creates the ls macro that runs dir with the same arguments.
doskey /historyShows the commands you have typed in this console.
doskey /macrosLists the defined macros.
doskey /listsize=100Keeps up to 100 commands in the history.
Notes and common mistakes
- Macros only exist in that console; to make them permanent, load them when opening it with /macrofile.
- The F7 key and the up and down arrows let you walk through the history.