DOSKEY

DOSKEY is a command for DOS, IBM OS/2, Microsoft Windows, and ReactOS that adds command history, macro functionality, and improved editing features to the command-line interpreters  and.

History
The command was included as a terminate-and-stay-resident program with MS-DOS and PC DOS versions 5 and later, then Windows 9x, and finally Windows 2000 and later.

In early 1989, functionality similar to  was introduced with DR-DOS 3.40 with its   CONFIG.SYS directive. This enabled a user-configurable console input history buffer and recall as well as pattern search functionality on the console driver level, that is, fully integrated into the operating system and transparent to running applications. In the summer of 1991,  was introduced in MS-DOS/PC DOS 5.0 in order to provide some of the same functionality. also added a macro expansion facility, though special support was required before applications such as command line processors could take advantage of it. Starting with Novell DOS 7 in 1993, the macro capabilities were provided by an external  command as well. In order to also emulate the  history buffer functionality under DR-DOS, the DR-DOS   worked as a front end to the resident history buffer functionality, which remained part of the kernel.

has also been included in IBM OS/2 Version 2.0.

In current Windows NT-based operating systems, the  functionality is built into CMD.EXE, although the   command is still used to change its operation.

The  command is not available in FreeDOS, which has such features built into the command interpreter.

Command switches
DOSKEY allows the use of several command switches:


 * /REINSTALL
 * Installs a new copy of DOSKEY.


 * /LISTSIZE=[size]
 * Sets size of command history buffer to size.


 * /MACROS
 * Displays all DOSKEY macros.
 * /MACROS:ALL
 * Displays all DOSKEY macros for all executables which have DOSKEY macros.
 * /MACROS:[executable name]
 * Displays all DOSKEY macros for the given executable.


 * /HISTORY
 * Displays all commands stored in memory.


 * /INSERT
 * Specifies that new text typed is inserted in old text.


 * /OVERSTRIKE
 * Specifies that new text overwrites old text.


 * /EXENAME=exename
 * Specifies the executable.


 * /MACROFILE=filename
 * Specifies a file of macros to install.


 * /APPEDIT
 * (undocumented - since MS-DOS 7)


 * /COMMAND
 * (undocumented - since MS-DOS 7)


 * /PERMANENT
 * (undocumented - since MS-DOS 7)


 * /SCRSIZE
 * (undocumented - since MS-DOS 7)


 * /XHISTORY
 * (undocumented - since MS-DOS 7)


 * [macroname]
 * Specifies a name for a macro created.


 * [text]
 * Specifies commands to record.

Keyboard shortcuts
During a DOSKEY session, the following keyboard shortcuts can be used:


 * and
 * Recall commands


 * Clears command line
 * Clears command line


 * Clears command line from the cursor to the beginning of the line.
 * Clears command line from the cursor to the beginning of the line.


 * Clears command line from the cursor to the end of the line.
 * Clears command line from the cursor to the end of the line.


 * Displays command history
 * Displays command history


 * Clears command history
 * Clears command history


 * Searches command history
 * Searches command history


 * Selects a command by number
 * Selects a command by number


 * Clears macro definitions
 * Clears macro definitions

Command macros
DOSKEY implements support for command macros, a simple text-substitution facility which is used somewhat like command line aliases in other environments.


 * $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 the macro name on command line.
 * Symbol replaced by everything following the macro name on command line.

Alternatives
The absence of a command history in  was a serious inconvenience ever since the earliest versions of MS-DOS. Numerous third-party programs have been written to address the issue; many were available long before Microsoft supplied DOSKEY. Some of them, including JP Software's 4DOS and NDOS, also provide additional editing capabilities lacking in DOSKEY, such as filename completion. Some of the better-known DOSKEY alternatives are Jack Gersbach's, Chris Dunford's  , Sverre Huseby's  , Ashok Nadkarni's  , Steven Calwas's  , Eric Tauck's  , and enhanced DOSKEY written by Paul Houle.

Paul Houle's Enhanced DOSKEY is designed to be an enhanced drop-in replacement for the DOSKEY.COM that ships with MS-DOS and Windows 9x/Windows Me. It also has a smaller disk and memory-resident footprint. The primary added feature is command and file "auto-completion" via the Tab key. Version 2.5, released in 2014, also adds full support for long filenames (LFN).