How does MS-DOS interpret commands?

Updated 8/31/2020 from

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

  • The computer checks command.com for internal command matches. If the entered command is not found, it goes to the next step.
  • The computer searches the current directory for executable files that match the command entered by the user. If there is no file matching the user’s command, it goes to the next step.
  • The computer examines each of the directories in the environment path that match the command entered by the user.
  • The following are various scenarios of how MS-DOS might interpret a command entered by a user.

    The user issues the command “dir

    The computer visits command.com and determines that dir is a valid internal command and executes the instructions for that command.

    The user issues the command “format

    The computer cannot find this command on the command.com website, but finds it in the path and runs it as an external command.

      How to run multiple commands in parallel on Linux?

    The user enters the name of a game they want to run

    The computer cannot find the command in command.com, but it finds an executable file in the current directory and runs that file.

    The user enters the name of a non-executable file or an executable file that does not exist in either path

    The computer cannot find the command or executable in the command.com directory, the current directory, or any of the paths and generates an “Invalid command or file name” error.