Create Interactive Menus in MS-DOS 6.22

MS-DOS 6.22 provides built-in tools for designing interactive terminal menus without requiring third-party programming environments. Users primarily create interactive command-line menus using the CHOICE.EXE utility within batch files, or they configure startup boot menus natively using multi-config directives inside CONFIG.SYS. This guide explains how both utilities function and demonstrates how to implement them to navigate programs, settings, and system configurations.

The CHOICE Utility for Batch File Menus

The primary tool for building runtime interactive menus in MS-DOS 6.22 is CHOICE.EXE. This utility halts batch file execution, prompts the user to press a key from a defined list of options, and returns the selection as an exit code (ERRORLEVEL).

Basic Syntax

CHOICE [/C:keys] [/N] [/S] [/T:c,nn] [text]
  • /C:keys: Specifies the allowable keys (defaults to YN).
  • /N: Hides the list of valid keys at the end of the prompt.
  • /S: Enables case sensitivity.
  • /T:c,nn: Defaults to key c after nn seconds.
  • text: The display string shown to the user.

Example Batch Menu

To construct a working menu, combine ECHO, CHOICE, and conditional branching using IF ERRORLEVEL. Note that IF ERRORLEVEL conditions must be evaluated in descending numerical order.

@ECHO OFF
CLS
:MENU
ECHO ===================================
ECHO         MAIN SYSTEM MENU
ECHO ===================================
ECHO 1. Launch File Manager
ECHO 2. Run Disk Defragmenter
ECHO 3. Exit to Command Prompt
ECHO ===================================
CHOICE /C:123 /N "Enter your choice (1-3): "

IF ERRORLEVEL 3 GOTO EXIT
IF ERRORLEVEL 2 GOTO DEFRAG
IF ERRORLEVEL 1 GOTO DOSKEY

:DOSKEY
ECHO Launching MS-DOS Shell...
DOSSHELL
GOTO MENU

:DEFRAG
ECHO Running Defrag...
DEFRAG C:
GOTO MENU

:EXIT
ECHO Returning to MS-DOS prompt.

Startup Menus with CONFIG.SYS

For menus displayed immediately at system boot, MS-DOS 6.22 provides a native multi-configuration menu block within the CONFIG.SYS file. This eliminates the need for separate boot floppies when switching between different memory or hardware profiles.

Key Directives

  • [MENU]: Declares the menu definition block.
  • MENUITEM=block_name,Display Text: Defines a selectable menu option.
  • MENUDEFAULT=block_name,seconds: Specifies the default profile and an optional timeout.
  • MENUCOLOR=text,background: Configures the console colors (0–15).

Example CONFIG.SYS Implementation

[MENU]
MENUITEM=Standard, Standard Memory Configuration
MENUITEM=Gaming, Expanded Memory (EMS) for Games
MENUDEFAULT=Standard, 10
MENUCOLOR=15,1

[Standard]
DEVICE=C:\DOS\HIMEM.SYS
DOS=HIGH

[Gaming]
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE RAM
DOS=HIGH,UMB

[COMMON]
DEVICE=C:\DOS\SETVER.EXE
FILES=40
BUFFERS=40

When a user selects an option in CONFIG.SYS, MS-DOS stores the selection in an environment variable named %CONFIG%. This variable can then be read by AUTOEXEC.BAT using standard GOTO %CONFIG% statements to load matching drivers, such as mouse drivers or sound card software.