Each time a command is entered into MS-DOS the computer will go through the below steps.
- Computer looks at the command.com for any internal command matches.
If the command entered is not found it continues to the next step.
- Computer looks for executable files in the current directory that match the user's command entered.
If no files exist that match the users command it continues to
the next step.
- 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 is unable to find this command in the
command.com or the local directory but finds it in the path
and executes the command as an external
command.
User enters the name of a game he or she wishes to run.
The computer is unable to locate the command in the
command.com but notices the executable is 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 is unable to 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".