Handling Quotes in MS-DOS 6.22 File Paths
This article explains how the MS-DOS 6.22 operating system and its
default shell, COMMAND.COM, process double quotation marks
(") within command-line file path arguments. It details the
relationship between the FAT16 file system, internal command processing,
the Program Segment Prefix (PSP) command tail, and how external programs
parse quoted parameters.
File System Limitations and FAT 8.3
MS-DOS 6.22 operates on standard FAT12 and FAT16 file systems, which adhere strictly to the 8.3 filename convention. Under this specification:
- Spaces and double quotation marks are illegal characters in file and directory names.
- Native Long File Names (LFN) with spaces were not introduced until Windows 95 (MS-DOS 7.0).
- Because valid file paths cannot contain spaces, MS-DOS 6.22 has no native file-system requirement to group path segments using quotation marks.
How COMMAND.COM Handles Quotes in Internal Commands
COMMAND.COM is responsible for parsing input for internal commands
such as DIR, TYPE, COPY, and
DEL.
When parsing arguments, COMMAND.COM uses specific delimiter
characters—primarily spaces, tabs, commas, semicolons, and equal
signs—to separate parameters. Unlike modern command processors like
Windows cmd.exe or PowerShell, the MS-DOS 6.22 interpreter
does not recognize double quotes as token grouping operators for file
paths:
- Literal Character Parsing: If a user wraps a path
in quotation marks (for example,
TYPE "CONFIG.SYS"), COMMAND.COM does not strip the quotes. It treats the quote as a literal part of the requested file name. - System Error Generation: Because
"is an illegal character under MS-DOS file-naming rules, the DOS kernel API (Interrupt 21h, Function 3Dh or similar) rejects the request, resulting in errors such asFile not foundorInvalid parameter. - Space Splitting: If a user attempts to enclose a
path containing spaces in quotes (for example,
DIR "C:\MY DIR"), COMMAND.COM still splits the string at the space character, treating"C:\MYandDIR"as two separate, invalid parameters.
External Program Processing and the PSP Command Tail
When executing an external program (such as an .EXE or
.COM binary), MS-DOS 6.22 passes command-line arguments via
the Program Segment Prefix (PSP) at offset 80h (the
"command tail"):
- Unmodified String Passing: MS-DOS 6.22 performs minimal preprocessing on the command tail. It copies the raw text entered after the executable name directly into the 128-byte PSP buffer, preserving any double quotation marks entered by the user.
- Application-Level Parsing: It is entirely the
responsibility of the target executable to parse this buffer. Most
external MS-DOS programs written in C (using Microsoft C, Borland C/C++,
or Watcom) utilize their compiler's runtime library (CRT) startup code
to convert the PSP buffer into the standard
argcandargv[]array. - CRT Behavior: Standard C runtime libraries in the DOS era do interpret double quotes as argument delimiters. If an external tool accepts quotes, the runtime library strips the surrounding double quotes and treats the enclosed text as a single argument, allowing the application to process parameters that contain embedded delimiters.