Microsoft DOS doskey command

Quick links

About doskey
Technical support

About doskey

Doskey is a MS-DOS utility that allows a user to keep a history of commands used on the computer. This allows frequently used commands to be used without having to type the commands in each time you need to use it.


The doskey.exe command is an external command and is available in the below Microsoft operating systems.

MS-DOS 5.0 and above
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista
Windows 7


Edits command lines, recalls command lines, and creates macros

DOSKEY [/switch ...] [macroname=[text]]

/BUFSIZE:size Sets size of macro and command buffer (default:512)
/ECHO:on|off nables/disables echo of macro expansions (default:on)
/FILE:file Specifies file containing a list of macros
/HISTORY Displays all commands stored in memory
/INSERT Inserts new characters into line when typing
/KEYSIZE:size Sets size of keyboard type-ahead buffer (default:15)
/LINE:size Sets maximum size of line edit buffer (default:128)
/MACROS Displays all DOSKey macros
/OVERSTRIKE Overwrites new characters onto line when typing (default)
/REINSTALL Installs a new copy of DOSKey
macroname Specifies a name for a macro you create
text Specifies commands you want to assign to the macro

Option keys

UP,DOWN arrows recall commands
Esc clears current command
F7 displays command history
Alt+F7 clears command history
[chars]F8 searches for command beginning with [chars]
F9 selects a command by number
Alt+F10 clears macro definitions

Below are special codes you can use in DOSKey macro definitions.

$T Command separator: allows multiple commands in a macro
$1-$9 Batch parameters: equivalent to %1-%9 in batch programs
$* Symbol replaced by everything following macro name on the command line



Starts doskey and allows you to press the up or down command to see history, or right or left to reType previous command.

Technical support

Specifying a buffer size larger than 61900 for DOSKEY causes the computer to freeze.

DOSKEY supports approximately 61900 bytes. Due to an error in the DOSKEY program that causes DOSKEY to mark memory as unused when it terminates and stays resident, specifying a buffer size larger than this amount causes the computer to hang.