How MS-DOS Resolves Command Name Conflicts

In MS-DOS 6.22, command execution relies on a strict internal hierarchy within the primary command interpreter, COMMAND.COM. When a user enters a command without specifying a file path or extension, the operating system must decide whether to run a built-in routine or search the disk for an executable file. This article examines the exact precedence rules MS-DOS 6.22 uses to resolve naming conflicts between internal shell commands and external utilities, as well as the methods users can employ to override this default behavior.

The Command Resolution Hierarchy

When a command is typed at the MS-DOS prompt, COMMAND.COM parses the input string and resolves potential name collisions using the following order of operations:

  1. Explicit Path or Extension Check: If the command contains a file path (such as C:\DOS\NAME or .\NAME) or a file extension (such as NAME.EXE), MS-DOS bypasses the internal command table entirely and searches directly for the specified external file.
  2. Internal Command Evaluation: If no path or extension is specified, COMMAND.COM checks its hardcoded internal command table. If a match is found (such as DIR, COPY, DEL, or REN), the internal routine executes immediately in memory. External files sharing that name are ignored at this stage.
  3. Current Working Directory Search: If the command is not in the internal table, COMMAND.COM inspects the current directory for executable files sharing the base name, checking extensions in a specific order:
    • .COM
    • .EXE
    • .BAT
  4. PATH Environment Variable Traversal: If no matching file is found in the current directory, COMMAND.COM evaluates the directories specified in the PATH environment variable from left to right. Within each directory, it searches using the same file extension priority (.COM, then .EXE, then .BAT).

Internal Command Dominance

Internal commands are loaded directly into conventional memory as part of COMMAND.COM during startup. Because they do not require disk access, they execute faster than external programs.

Because internal commands sit at the top of the evaluation chain when bare names are entered, creating an external utility named DEL.EXE or COPY.BAT in the current working directory will not naturally override the built-in DEL or COPY commands. Typing DEL will always trigger the internal deletion routine.

Overriding Internal Commands

To force MS-DOS 6.22 to execute an external utility that shares its name with an internal command, you must explicitly differentiate the input from a bare command:

  • Specify the Extension: Typing DEL.EXE or COPY.BAT forces COMMAND.COM to skip internal command matching and locate the external file matching that full filename.
  • Specify a Path: Prefixing the command with a relative or absolute path (such as .\DEL.EXE or C:\TOOLS\DIR.COM) explicitly instructs the interpreter to look on the disk rather than in its internal memory table.