Bad command or file name
Microsoft MS-DOS
Severity: MinorWhat Does This Error Mean?
Bad command or file name means DOS could not find the command you typed — either because it is misspelled, the program is not in the current directory, or it is not in the PATH. Check the spelling and make sure you are in the correct directory.
Affected Models
- MS-DOS 3.x
- MS-DOS 4.x
- MS-DOS 5.x
- MS-DOS 6.x
- PC-DOS
- FreeDOS
- DOSBox
Common Causes
- Command or filename typed incorrectly
- Program (.EXE or .COM file) not in the current directory
- Directory containing the program not listed in the PATH environment variable
- Trying to run a file with the wrong extension (e.g. a .BAT file renamed to .TXT)
- Drive letter or directory does not exist
How to Fix It
-
Check the spelling of the command.
DOS is not case-sensitive for commands, but spelling must be exact. DIR, dir, and Dir all work — but DIER gives Bad command or file name.
-
Type DIR and press Enter to see what files are in the current directory.
DIR lists all files and subdirectories. If the program you want to run is not listed, you are in the wrong directory.
-
Navigate to the correct directory with the CD command.
CD C:\GAMES\DOOM takes you to the DOOM directory. Then type DOOM (or whatever the .EXE is named) to run it.
-
Check and update the PATH variable to include the program's directory.
PATH tells DOS where to look for programs. Type PATH to see the current path. Add a directory: PATH C:\TOOLS;%PATH% makes DOS search C:\TOOLS automatically.
-
In DOSBox: check that the drive is mounted and contains the correct files.
In DOSBox type MOUNT C C:\DOSGAMES to mount a folder as drive C, then C: to switch to it. Type DIR to confirm your files are present.
Frequently Asked Questions
Why does MS-DOS give this error instead of saying the file was not found?
DOS distinguishes between built-in commands (like DIR, CD, COPY) and external programs. If neither a built-in command nor an external .EXE/.COM/.BAT file matches, it gives this single generic message — frustratingly unhelpful, but that was 1980s DOS.
Is Bad command or file name the same in all DOS versions?
Yes — this exact message appears in all versions of MS-DOS and PC-DOS from version 1.0 through 6.22. FreeDOS and DOSBox replicate it faithfully.