Microsoft KB Archive/36312

Executable File Format of Replacement Command Interpreters ID Number: Q36312

2.x 3.x 4.00 MS-DOS

Summary:

If you are writing command interpreters (replacements for the default MS-DOS command processor COMMAND.COM) you must consider what style of executable file format is used. If the replacement command interpreter (installed through the SHELL command in the CONFIG.SYS file) is a .COM file, it will be able to work in MS-DOS Versions 2.x through Version 4.00. If, however, the command interpreter is an .EXE file, it will work properly on MS-DOS Versions 3.x and above. It will not work under MS-DOS Version 2.x, and MS-DOS will give the error message “Bad or missing command interpreter.”

MS-DOS Versions 2.x assume that the command interpreter is a .COM file. MS-DOS Versions 3.x and above use the EXEC system call, interrupt 21h service 4Bh, to call the command interpreter. This EXEC call is able to load .COM or .EXE files, thus allowing the command interpreter in MS-DOS Versions 3.x and later to be either .COM or .EXE. The code for EXEC in these later versions of MS-DOS is included in MSDOS.SYS, which is the part of the MS-DOS kernel that interprets the SHELL command in the CONFIG.SYS file.