Disable AUTOEXEC.BAT in MS-DOS 6.22 COMMAND.COM
In MS-DOS 6.22, managing how the primary command interpreter
initializes is essential for system maintenance, memory optimization,
and troubleshooting. This article explains how COMMAND.COM
handles the execution of AUTOEXEC.BAT, identifies the
specific parameter behaviors that govern startup script processing, and
covers alternative methods to bypass the batch file during system
startup.
The Role of the /P Switch
In MS-DOS 6.22, COMMAND.COM does not contain a dedicated
parameter specifically designed to "turn off" AUTOEXEC.BAT
(unlike modern Windows interpreters like CMD.EXE, which use
the /D switch to disable AutoRun registry scripts).
Instead, the auto-execution of AUTOEXEC.BAT is an opt-in
behavior controlled strictly by the /P (Permanent)
switch.
By default, launching COMMAND.COM without parameters
starts a secondary shell that completely ignores
AUTOEXEC.BAT. The interpreter only searches for and
executes AUTOEXEC.BAT if the /P switch is
explicitly provided on the command line:
COMMAND.COM /P
Because omitting the /P switch prevents the execution of
AUTOEXEC.BAT, running COMMAND.COM on its own
or without /P acts as the mechanism to disable
auto-execution. However, running the primary shell without
/P makes it transient, meaning typing EXIT
will attempt to terminate the top-level command processor.
Stepping Through Execution with the /Y Switch
MS-DOS 6.0 and later versions, including MS-DOS 6.22, introduced the
/Y switch for COMMAND.COM. When used in
conjunction with the /P switch, /Y instructs
the command interpreter to step through AUTOEXEC.BAT line
by line, prompting the user for confirmation before executing each
command:
COMMAND.COM /Y /P
This switch allows you to selectively disable every command within
AUTOEXEC.BAT without modifying the file itself or altering
the permanent status of the command interpreter.
Disabling AUTOEXEC.BAT via CONFIG.SYS
The initial invocation of COMMAND.COM during boot is
defined in CONFIG.SYS through the SHELL=
directive. A typical entry appears as follows:
SHELL=C:\DOS\COMMAND.COM C:\DOS\ /P /E:512
To prevent AUTOEXEC.BAT from running automatically at
startup, remove the /P switch or modify the target
filename:
- Remove
/P: Changing the directive toSHELL=C:\DOS\COMMAND.COM C:\DOS\ /E:512disables the automatic execution ofAUTOEXEC.BAT, though the system will prompt for the date and time and allowEXITto terminate the shell. - Point to an Alternative File: Adding the
/Kequivalent in MS-DOS or pointing to an alternate shell suppresses the default batch file search.
Hardware and Keyboard Bypasses at Boot
If your goal is to bypass AUTOEXEC.BAT during system
startup without reconfiguring COMMAND.COM:
- Clean Boot (F5): Pressing F5 when
the message "Starting MS-DOS..." appears bypasses both
CONFIG.SYSandAUTOEXEC.BATentirely, loading a minimalCOMMAND.COMenvironment. - Interactive Boot (F8): Pressing F8
at boot prompts for confirmation for each directive in
CONFIG.SYS, followed by an explicit prompt asking whether to runAUTOEXEC.BAT([Y/N]). ChoosingNdisables execution.