Batch File Extension in MS-DOS 6.22
This article explains the mandatory file extension required to execute batch scripts in MS-DOS 6.22. It covers the specific extension recognized by the operating system's command interpreter, how execution priority works, and why alternative script extensions from newer systems will not function in this environment.
In MS-DOS 6.22, the only file extension strictly required and supported for batch execution scripts is .BAT.
The MS-DOS command processor, COMMAND.COM, relies
entirely on this three-letter extension to identify plain-text files
containing sequences of commands. If a script uses any other extension,
the operating system will not execute it as a batch program.
Command Execution Order
When a user types a command without specifying a file extension,
COMMAND.COM searches for an executable match in the
following order:
- Internal Commands (e.g.,
DIR,COPY,DEL) - .COM (Compiled binary files)
- .EXE (Executable binary files)
- .BAT (Batch files)
Because .BAT is last in the search hierarchy, an
executable file sharing the same base name (such as
test.exe) will run instead of test.bat unless
the .BAT extension is explicitly included in the
command.
Incompatible Modern Extensions
Later operating systems, such as OS/2 and Windows NT, introduced the
.CMD extension for command scripts. MS-DOS 6.22 does not
recognize .CMD files as executable scripts. Attempting to
run a .CMD file in MS-DOS 6.22 results in a "Bad command or
file name" error.
Formatting Requirements
To execute correctly, an MS-DOS 6.22 batch file must adhere to standard DOS constraints:
- The file must be saved as plain ASCII text.
- The name must follow the 8.3 filename convention (maximum of eight
characters for the name, followed by
.BAT). - Each command within the file must be placed on a separate line.