Bad command or file name

From HandWiki
Screenshot of the error in MS-DOS

"Bad command or file name" is a common and ambiguous error message in MS-DOS and some other operating systems.[1]

COMMAND.COM, the primary user interface of MS-DOS, produces this error message when the first word of a command could not be interpreted. For MS-DOS, this word must be the name of an internal command, executable file or batch file,[2] so the error message provided an accurate description of the problem but easily confused novices. Though the source of the error had to be the first word (often a mistyped command), the wording gave the impression that files named in later words were damaged or had illegal filenames. Later, the wording of the error message was changed for clarity. Windows NT displays the following error message instead (where "foo" is replaced by the word causing error):[3]

"foo" is not recognized as an internal or external command,
operable program or batch file.

Some early Unix shells produced the equally cryptic "foo: no such file or directory" for the same reasons. Most modern shells produce an error message similar to "foo: command not found".[4][5][6]

See also

References

  1. Jim Cooper, (2002). Using MS-DOS 6.22. Que Publishing. ISBN:9780789725738
  2. "Instructions". MSDN. Microsoft. https://msdn.microsoft.com/en-us/library/cc750871.aspx. Retrieved March 8, 2015. 
  3. Harry Phillips, Eric Skagerberg, (2002). "New Perspectives on Microsoft Windows 2000 MS-DOS Command Line, Comprehensive, Windows XP Enhanced". Cengage Learning. ISBN:1285963679
  4. "bash - execute_cmd.c" (in en). https://git.savannah.gnu.org/cgit/bash.git/tree/execute_cmd.c?id=9439ce094c9aa7557a9d53ac7b412a23aa66e36b#n5586. 
  5. "dash - main.c" (in en). https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/src/main.c?id=057cd650a4edd5856213d431a974ff35c6594489#n318. 
  6. "zsh - exec.c" (in en). https://github.com/zsh-users/zsh/blob/06e5ec914fdedac6446e02c9427a1706dda9c505/Src/exec.c#L763.