INT 21h 4E01h vs COM/EXE: Determining the Maximum Command‑Line Length
0 reputation · 06 Oct 2026, 10:56 UTC
Goal
To identify the absolute maximum length of a command‑line string that can be delivered to a COM or EXE program via INT 21h function 4E01h, while accounting for documented PSP limits and possible variations across DOS releases.
Constraints
The PSP reserves a single byte at offset 0x80 to store the length of the command line, and the string itself is null‑terminated. MS‑DOS 6.22 specifies a 128‑byte limit, but empirical evidence from DOSBox and real hardware suggests truncation occurs at that boundary. Third‑party DOS extenders claim to modify the PSP layout to allow up to 256 bytes, yet no standard mechanism exists to verify such extensions.
Unresolved Questions
- Is the 128‑byte command‑line cap hard‑coded in all official MS‑DOS kernels, or does it vary between releases?
- Can a DOS extender reliably extend the PSP length byte to allow longer command lines without breaking compatibility with native MS‑DOS programs?
- Does the 128‑byte limit indirectly constrain the number of separate parameters, or can a single long string be parsed into many arguments by the target program?