How MS-DOS 6.22 Executes CONFIG.SYS Menus

MS-DOS 6.22 allows users to create boot-time configuration menus directly within the CONFIG.SYS file to manage hardware profiles and memory settings. This article explains the internal parsing logic and execution flow that MS-DOS 6.22 uses to present these menus, interpret user selections, execute configuration directives within target blocks, and pass environment variables to AUTOEXEC.BAT.

The Structure of a Menu-Driven CONFIG.SYS

A multi-config CONFIG.SYS file relies on labeled section blocks enclosed in square brackets. The system divides instructions into three distinct block types:

  • [menu]: Contains the menu definition commands, such as menuitem, menudefault, submenu, and menucolor.
  • Unique Configuration Blocks: User-defined labels (such as [normal] or [gaming]) that hold specific system commands like DEVICE, DEVICEHIGH, DOS, BUFFERS, and FILES.
  • [common]: A universal block for commands that must execute regardless of the menu choice made by the user.

Step 1: Boot-Time Parsing and Menu Display

During the boot sequence, IO.SYS initializes core hardware routines and processes CONFIG.SYS. When the MS-DOS parser detects the [menu] block:

  1. It halts standard linear command execution.
  2. It parses the menuitem directives to generate a formatted, numbered text menu on the screen.
  3. If configured, it initializes a countdown timer via the menudefault directive.
  4. It waits for keystroke input from the user or until the timer reaches zero.

Step 2: Selection and the %CONFIG% Environment Variable

Once the user selects an option, MS-DOS 6.22 executes two operations simultaneously:

  1. It flags the corresponding block label as the active configuration path for the rest of CONFIG.SYS.
  2. It creates a dynamic system environment variable named CONFIG and sets its value to the name of the chosen block (for example, CONFIG=gaming).

Step 3: Block Execution and Directive Filtering

After the selection is registered, MS-DOS resumes reading CONFIG.SYS sequentially from top to bottom. It treats the file as a single stream but applies strict conditional filtering:

  • Matching Blocks: When the parser encounters the block header matching the user's choice, it executes every directive line by line until it hits another block header.
  • Non-Matching Blocks: Any block header that does not match the chosen selection is ignored, and all directives within it are skipped entirely.
  • Common Blocks: Any instructions under a [common] block are executed sequentially, regardless of what option was chosen.
  • Include Directives: If a selected block contains an include=blockname directive, the parser temporarily jumps to the specified block, executes its commands, and then returns to the active block.

Step 4: Handoff to AUTOEXEC.BAT

Once MS-DOS completes the CONFIG.SYS file, control shifts to COMMAND.COM and AUTOEXEC.BAT. Because CONFIG.SYS does not run standard batch commands or executable programs directly, it relies on the CONFIG environment variable established during the menu step.

AUTOEXEC.BAT uses the GOTO %CONFIG% command to jump to matching label sections (such as :gaming or :normal). This allows the operating system to selectively run matching TSRs (Terminate and Stay Resident programs), sound card drivers, mouse utilities, and CD-ROM extensions that correspond directly to the initial CONFIG.SYS menu selection.