Role of AUTOEXEC.BAT in MS-DOS 6.22 Boot Sequence

The AUTOEXEC.BAT file serves as the final, user-configurable stage of the MS-DOS 6.22 startup process, automatically executing a series of commands every time the computer boots. Positioned directly after the operating system kernel and core system drivers are initialized, this root-directory batch script establishes the operating environment, configures global system variables, loads essential background utilities, and determines whether the system stops at the command prompt or launches directly into an application or graphical shell.

Position in the Boot Order

During the MS-DOS 6.22 boot sequence, the machine progresses through hardware power-on self-tests (POST), the Master Boot Record, and the core files IO.SYS and MSDOS.SYS. The operating system then processes CONFIG.SYS, which configures low-level system settings, memory management architectures (such as HIMEM.SYS and EMM386.EXE), and hardware device drivers.

Once CONFIG.SYS completes, IO.SYS loads the primary command processor, COMMAND.COM. COMMAND.COM immediately searches the root directory of the boot drive for AUTOEXEC.BAT (short for "automatic execution batch"). If found, the command interpreter executes every command within this file sequentially before handing control over to the user.

Core Functions of AUTOEXEC.BAT

In MS-DOS 6.22, AUTOEXEC.BAT performs several critical configuration tasks that transform the raw command environment into a functional workspace:

  • Defining Environment Variables: It sets crucial environment variables using the SET command. The most vital is the PATH variable, which specifies the directories the system searches when a command or program is executed. It also sets variables like TEMP or TMP to define scratchpad directories for programs.
  • Customizing the Command Interface: The PROMPT command defines how the command prompt appears. The standard PROMPT $P$G command displays the current drive letter and active directory followed by a greater-than symbol (e.g., C:\DOS>).
  • Loading TSRs and Peripheral Utilities: Unlike low-level drivers loaded via DEVICE= in CONFIG.SYS, several critical utilities operate as Terminate-and-Stay-Resident (TSR) programs loaded in AUTOEXEC.BAT. Typical examples include:
    • SMARTDRV.EXE to enable disk caching for faster read/write operations.
    • MSCDEX.EXE to provide MS-DOS extensions for reading ISO-9660 CD-ROM drives.
    • Mouse utilities (such as MOUSE.COM).
    • DOSKEY.EXE for command-line history and macro functionality.
  • Memory Optimization: In conjunction with MS-DOS 6.22's memory management, TSRs inside AUTOEXEC.BAT are frequently prefaced with the LH or LOADHIGH command. This instructs DOS to load these utilities into Upper Memory Blocks (UMBs), preserving the critical 640 KB conventional memory space for applications.
  • Multi-Configuration Processing: MS-DOS 6.22 introduced native multi-boot menus defined in CONFIG.SYS. AUTOEXEC.BAT supports this by reading the %CONFIG% environment variable, using labels and GOTO statements to execute specific configurations depending on the user's startup menu selection.
  • Auto-Starting Applications: The script can terminate with a command that immediately starts a program, such as a file management utility, an enterprise database system, or the WIN command to launch Windows 3.1 or Windows for Workgroups 3.11.

If AUTOEXEC.BAT is missing from the boot drive, COMMAND.COM bypasses the automated configuration, prompts the user manually for the current date and time, and drops directly to a standard C:\> prompt with minimal environment configuration.