MS-DOS 6.22 Path Length Limits and File Access

MS-DOS 6.22 strictly restricts file and directory paths based on the constraints of the 16-bit FAT file system and internal operating system buffers. When a directory path exceeds the architectural limit, MS-DOS 6.22 halts file access operations, returns specific DOS interrupt error codes, and rejects commands issued via COMMAND.COM. This article outlines the system limits of MS-DOS 6.22, explains how system calls respond to oversized paths, and covers the primary historical workaround used to access deeply nested files.

The 67-Character Path Constraint

The path limit in MS-DOS 6.22 is fundamentally determined by the Current Directory Structure (CDS). The operating system allocates fixed 67-byte memory arrays to store fully qualified paths for each logical drive. This 67-byte allocation includes:

  • The drive letter and colon (e.g., C:) — 2 characters
  • The root backslash (\) — 1 character
  • The directory path and filename string — up to 63 characters
  • A null terminating byte (0x00) — 1 character

Because of this rigid data structure, the maximum fully qualified path length cannot exceed 66 printable characters plus the null terminator.

Interrupt 21h and File Access Operations

When applications interact with files, they make requests via MS-DOS software interrupt INT 21h. Functions such as 3Dh (Open File), 39h (Create Directory / MKDIR), and 3Bh (Change Directory / CHDIR) receive a pointer to an ASCIIZ string containing the path.

When an operation provides a path string that exceeds the buffer limits, the DOS kernel processes the request as follows:

  1. Path Parsing and Validation: The DOS kernel parses the path token by token (separated by backslashes), validating each directory against the standard 8.3 naming convention.
  2. Buffer Boundary Check: If the cumulative length of the string exceeds the remaining space in the internal CDS buffer, or if the fully qualified resolution exceeds 67 bytes, the operation fails.
  3. Error Reporting: The kernel sets the CPU Carry Flag (CF) to signal an error and returns error code 03h (Path Not Found) in the AX register. In instances where an invalid path syntax or buffer boundary error occurs on command-line inputs, COMMAND.COM displays standard error strings such as Path too long or Invalid directory.

MS-DOS 6.22 does not automatically truncate oversized paths for standard file opening or creation calls; instead, it outright refuses to execute the requested disk operation to prevent buffer overflows and directory table corruption.

Handling via the SUBST Command

When users or batch files in MS-DOS 6.22 needed to interact with paths that naturally exceeded the limit through excessive nesting, the standard workaround was the SUBST utility.

SUBST assigns a virtual drive letter to a subpath:

SUBST X: C:\LEVEL1\LEVEL2\LEVEL3\LEVEL4

By substituting a long directory string with an independent drive letter (X:), the path counter resets to the root of X:\. This allows standard file operations, directory traversals, and executable launches to proceed within nested hierarchies that would otherwise trigger Path Not Found errors.