MS-DOS 6.22 PATH Parsing for Invalid Directories

MS-DOS 6.22 processes system PATH entries as literal strings without verifying whether the specified directories actually exist on the file system. When a user defines a PATH containing invalid or non-existent directories, the operating system accepts the definition without error, silently skips those invalid directories during command searches, and proceeds to the next listed path until a match is found or the search space is exhausted.

PATH Definition and Storage

When setting the search path using the PATH command or the SET PATH= environment syntax—typically within AUTOEXEC.BAT—MS-DOS 6.22 does not perform any validation. The command processor (COMMAND.COM) treats the assigned value purely as an ASCII string and writes it directly to the environment block. Characters, drive letters, and directory names are not checked for existence, disk availability, or syntax accuracy at the time of assignment.

Command Lookup and Execution Flow

When an external command, batch file, or executable (.COM, .EXE, or .BAT) is called without an explicit path, COMMAND.COM resolves the executable using a strict sequential lookup:

  1. Current Directory: MS-DOS first checks the current working directory for the executable file.
  2. Sequential PATH Traversal: If the command is not in the current directory, COMMAND.COM reads the PATH variable and evaluates each entry delimited by a semicolon (;), scanning strictly from left to right.
  3. Interrupt 21h File Search: For each entry, DOS constructs a qualified path and issues a DOS API call (typically INT 21h, AH=4Eh for Find First File) to locate the requested executable.
  4. Handling Invalid Paths: If the target directory does not exist, the underlying file system returns a standard DOS error code (such as Error 03h: Path Not Found). COMMAND.COM handles this internally by discarding the error and immediately advancing to the next semicolon-delimited token in the PATH.
  5. Termination: The process repeats until a matching executable extension is found. If all tokens are parsed and no executable is located, MS-DOS outputs the standard error message: Bad command or file name.

Performance and Behavioral Implications

While non-existent directories do not cause crashes or immediate syntax errors, they affect system performance. For every invalid entry, MS-DOS 6.22 still attempts disk I/O to query the directory structure.

On local hard disks using FAT16, this creates redundant directory table lookups. The performance penalty becomes noticeably worse if the invalid directory points to a removable media drive (such as A:), an empty optical drive, or a disconnected network share (via Microsoft Network Client), where the operating system will pause while polling the device before failing and proceeding to the next path.