How does MS-DOS interpret commands?

Updated: 08/31/2020 by Computer Hope
Windows DOS command prompt window

Each time a command is entered into MS-DOS, the computer goes through the steps below.

  1. Computer looks at the command.com for any internal command matches. If the command entered is not found, it continues to the next step.
  2. Computer looks for executable files in the current directory that match the user's command entered. If no files exist that match the user's command, it continues to the next step.
  3. Computer looks at each of the directories in the environment path that match the user's command entered.

Below are some different scenarios of how MS-DOS may interpret a command that a user enters.

User enters the "dir" command

The computer looks at the command.com and notices that dir is a valid internal command and executes the instructions for that command.

User enters the "format" command

The computer can't find this command in the command.com, but finds it in the path and executes it as an external command.

User enters the name of a game he or she wishes to run

The computer can't find the command in command.com, but locates an executable in the current directory and runs that file.

User enters a name of a non-executable file or an executable file that does not exist in any of the paths

Computer cannot locate the command or executable file in the command.com, current directory, or in any of the paths, and generates the error "Bad command or file name."