MS-DOS and Windows command line doskey command

Doskey is an MS-DOS utility that allows the user to keep a history of all commands used on a computer. Doskey allows frequently used commands to be executed without having to type them each time they are needed.
Availability
Doskey is an external command and is available for the following Microsoft operating systems as doskey.exe.
- MS-DOS 5.0 and above
- Windows 95
- Windows 98
- Windows ME
- Windows NT
- Windows 2000
- Windows XP
- Windows Vista
- Windows 7
- Windows 8
- Windows 10
Doskey syntax
Windows Vista and later syntax
DOSKEY [/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]] [/HISTORY] [/INSERT | /OVERSTRIKE] [/EXENAME=exename] [/MACROFILE=filename] [macroname=[text]]
| /REINSTALL | Installs a new copy of Doskey. |
| /LISTSIZE=size | Sets the size of command history buffer. |
| /MACROS | Displays all Doskey macros. |
| /MACROS:ALL | Displays all Doskey macros for all executables which have Doskey macros. |
| /MACROS:exename | Displays all Doskey macros for the given executable. |
| /HISTORY | Displays all commands stored in memory. |
| /INSERT | Specifies that new text you type is inserted in the old text. |
| /OVERSTRIKE | Specifies that new text overwrites old text. |
| /EXENAME=exename | Specifies the executable. |
| /MACROFILE=filename | Specifies a file of macros to install. |
| macroname | Specifies a name for a macro you create. |
| text | Specifies commands you want to record. |
Option keys
| UP, DOWN | The up and 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. |
The following are some special codes 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. |
Windows XP and earlier syntax
DOSKEY [/switch ...] [macroname=[text]]
| /BUFSIZE:size | Sets the size of macro and command buffer. | (default:512) |
| /ECHO:on|off | Enables/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 the size of keyboard type-ahead buffer. | (default:15) |
| /LINE:size | Sets the maximum size of line edit buffer. | (default:128) |
| /MACROS | Displays all Doskey macros. | |
| /OVERSTRIKE | Overwrites new characters onto the 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. |
Doskey examples
doskey
Starts doskey and allows you to press the up or down command to see history, or right or left to retype the previous command.
doskey /history
Show the history of commands run at the command prompt. Since doskey is loaded by default with recent versions of Windows, it's an easy way to determine what commands were run on any open Windows command line window.
Technical support
Specifying a buffer size larger than 61900 for doskey causes the computer to freeze.
Doskey only supports approximately 61900 bytes due to an error in the doskey program.
