Clear DOSKEY Macros with REINSTALL in MS-DOS 6.22
In MS-DOS 6.22, the DOSKEY /REINSTALL command serves as
the primary mechanism for wiping all active macros from memory
simultaneously. While individual macros can be removed one by one,
MS-DOS does not provide a dedicated "clear all" flag for macros.
Invoking /REINSTALL reinitializes the utility, effectively
resetting the macro definition table and command history buffer at the
cost of additional conventional memory usage.
The Problem with Clearing Macros in MS-DOS 6.22
When working with DOSKEY in MS-DOS 6.22, users frequently define macros to create shortcuts or automate command sequences using the syntax:
DOSKEY name=command
To remove a single macro, DOSKEY requires defining the macro name with an empty string:
DOSKEY name=
If a user loads dozens of macros—often via batch files—clearing them
manually becomes impractical. MS-DOS 6.22 lacks a native parameter such
as /CLEAR or /RESET to flush the macro buffer
cleanly.
How DOSKEY /REINSTALL
Works
The /REINSTALL switch bypasses the manual deletion
process by loading a fresh copy of the DOSKEY
terminate-and-stay-resident (TSR) program into memory:
DOSKEY /REINSTALL
When this command runs, it accomplishes three key actions:
- Flushes Active Macros: The newly initialized instance starts with an empty macro buffer. Any macros previously defined in the command session are no longer recognized by the command interpreter.
- Clears Command History: The buffer storing previously entered commands (accessible via the up and down arrow keys) is completely cleared.
- Allocates a New Buffer: You can combine
/REINSTALLwith the/BUFSIZEswitch (e.g.,DOSKEY /REINSTALL /BUFSIZE=1024) to resize the buffer allocated for new macros and history entries.
The Memory Trade-Off
Although DOSKEY /REINSTALL solves the issue of purging
all macros at once, it has a significant limitation: it does not unload
the original DOSKEY executable from RAM.
Instead, MS-DOS places another copy of the DOSKEY driver into
conventional memory. Each reinstallation consumes approximately 3 to 4
kilobytes of RAM. In an operating system where the 640 KB conventional
memory limit is strictly managed, repeatedly running
DOSKEY /REINSTALL causes memory fragmentation and reduces
the RAM available for running other programs.
Recommended Usage
Because of memory consumption, DOSKEY /REINSTALL should
not be used repeatedly in automated loops or persistent scripts. It is
best reserved for interactive command-line sessions where an immediate
reset of all shortcut definitions is required without restarting the
machine. If memory conservation is critical, defining macros via
targeted batch files or restarting the shell remains the cleanest way to
manage macro lifecycles.