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 asmenuitem,menudefault,submenu, andmenucolor.- Unique Configuration Blocks: User-defined labels
(such as
[normal]or[gaming]) that hold specific system commands likeDEVICE,DEVICEHIGH,DOS,BUFFERS, andFILES. [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:
- It halts standard linear command execution.
- It parses the
menuitemdirectives to generate a formatted, numbered text menu on the screen. - If configured, it initializes a countdown timer via the
menudefaultdirective. - 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:
- It flags the corresponding block label as the active configuration
path for the rest of
CONFIG.SYS. - It creates a dynamic system environment variable named
CONFIGand 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=blocknamedirective, 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.