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:

  1. Remove /P: Changing the directive to SHELL=C:\DOS\COMMAND.COM C:\DOS\ /E:512 disables the automatic execution of AUTOEXEC.BAT, though the system will prompt for the date and time and allow EXIT to terminate the shell.
  2. Point to an Alternative File: Adding the /K equivalent 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.SYS and AUTOEXEC.BAT entirely, loading a minimal COMMAND.COM environment.
  • Interactive Boot (F8): Pressing F8 at boot prompts for confirmation for each directive in CONFIG.SYS, followed by an explicit prompt asking whether to run AUTOEXEC.BAT ([Y/N]). Choosing N disables execution.