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=orden

    Defines a macro; $* in the command is replaced by the arguments.

  • /history

    Shows the history of commands typed in the console.

  • /macros

    Shows the defined macros.

  • /listsize=N

    Changes the number of commands kept in the history.

  • /macrofile=fichero

    Loads macros from a file.

  • /reinstall

    Installs 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 /history

    Shows the commands you have typed in this console.

  • doskey /macros

    Lists the defined macros.

  • doskey /listsize=100

    Keeps 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.

Related commands