Bad command or file name

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Bad command or file name.PNG

"Bad command or file name" is a common error message in Microsoft's MS-DOS and some other operating systems.[1] It is sometimes used as an example of a computer message that is perfectly accurate yet confusing to users[citation needed].

COMMAND.COM produced the message "Bad command or file name" when the user mistyped the first word of a command. This first word must be either the name of a built-in "command", or of an executable file or batch file. Therefore the error was printing what, to the programmer, was an accurate description of the problem: there was no such command and there was no such file. However the actual problem, most often, was that the user mistyped a command. The message is extremely confusing if the command line also has some file names, since it makes the user think there is something wrong with them, not with the first word. Recent operating systems changed the error message to be more helpful to users; for instance both OS/2and the Windows NT family output foo is not recognized as an internal or external command, operable program or batch file., where foo is the unrecognized command or nonexistent file.

Some early Unix shells sent the equally cryptic "foo: no such file or directory"[2] to stderror due to a nonexistent file. Most modern shells produce "foo: command not found."

See also[edit]


  1. ^ Jim Cooper, (2002). Using MS-DOS 6.22. Que Publishing. ISBN 9780789725738
  2. ^ A current example is tclsh with the command "exec nosuchcommand"