COMMAND.COM search order: After checking the current directory for a requested command, where does DOS search next to locate an executable?

Difficulty: Easy

Correct Answer: The PATH statement

Explanation:


Introduction / Context:
When you type a command in DOS, the command interpreter (COMMAND.COM) follows a defined search order to find the executable. Knowing how PATH works is crucial for troubleshooting “Bad command or file name” errors and organizing tools across directories.


Given Data / Assumptions:

  • You invoke a command that is not internal to COMMAND.COM.
  • The current directory does not contain the executable.
  • System environment variables (especially PATH) may be set.


Concept / Approach:
After checking for an internal command or a program in the current directory, DOS consults the PATH environment variable. PATH lists directories to search (in order) for .COM, .EXE, and .BAT files. CONFIG.SYS and AUTOEXEC.BAT are configuration/startup files, not places to search; they may define PATH but are not searched per-command.


Step-by-Step Solution:

Identify that the command is not in the current directory.Recall the next step: search the directories listed in PATH.Therefore, “The PATH statement” is the correct answer.


Verification / Alternative check:
Use the SET command to view PATH; temporarily remove a directory from PATH and observe that commands in that directory become unavailable unless referenced with a full path.


Why Other Options Are Wrong:
C:\DOS\UTILITIES: might be a directory in PATH but is not universally searched unless in PATH. Config.sys / Autoexec.bat: not part of per-command search; they simply set environment.


Common Pitfalls:
Assuming DOS searches the entire drive automatically; relying on full paths for every command instead of maintaining PATH correctly.


Final Answer:
The PATH statement

More Questions from Disk Operating System (DOS)

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion