Fixing 'Bad Command or File Name' Errors on FreeDOS
This message covers several genuinely different underlying causes — a typo, a missing PATH entry, a missing file extension, or a corrupted COMMAND.COM. Here's how to tell them apart.
“Bad command or file name” is FreeDOS’s generic catch-all for “I don’t know what you’re asking me to run” — which covers several distinct underlying causes, each with a different fix.
Step 1: check for the simplest cause first — a typo
DIR <intended-command-name>*.*
Searching for the command’s likely filename directly rules in or out a simple spelling mistake before investigating anything more involved — this resolves a surprising fraction of these errors on its own.
Step 2: confirm the file actually exists somewhere on the system
DIR C:\ /S | FIND "COMMANDNAME"
If the executable genuinely isn’t present anywhere on the disk, no PATH configuration will help — you need to actually install or restore the program first.
Step 3: check whether the command exists but isn’t in the current PATH
PATH
If the file was found in Step 2 but in a directory not listed in the current PATH, either add that directory to PATH in AUTOEXEC.BAT, or run the command using its full path directly (C:\TOOLS\PROGRAM.EXE rather than just PROGRAM).
Step 4: check for a missing or wrong file extension
DIR PROGRAM.*
DOS needs to know whether a command is a .COM, .EXE, or .BAT file to run it correctly — running a command by typing its name without an extension normally works fine because DOS checks all three in order, but a renamed or unusually-extensioned file can confuse this resolution.
Step 5: check for a corrupted or missing COMMAND.COM
VER
If even basic built-in commands (DIR, COPY, VER itself) are failing with this error, COMMAND.COM — the shell interpreting your commands in the first place — may itself be missing or corrupted, which is a considerably more serious problem than a single missing program.
Step 6: restore COMMAND.COM from installation media, if Step 5 confirms this
Boot from a FreeDOS installation/boot disk, then:
COPY A:\COMMAND.COM C:\
Step 7: check AUTOEXEC.BAT and CONFIG.SYS for a reference to a missing file
TYPE C:\AUTOEXEC.BAT
TYPE C:\CONFIG.SYS
An error appearing specifically and only during boot, rather than when you type a command interactively, usually traces to one of these startup files referencing a program or driver that’s since been moved, renamed, or deleted.
Step 8: check for a batch file calling another batch file incorrectly
TYPE MYSCRIPT.BAT
A batch file referencing another command or script with an incorrect path or filename produces this same error when the batch file runs, even though the original command you actually typed was correct — worth checking the contents of any batch file involved, not just what you typed directly.
Why distinguishing “file missing” from “file misconfigured” matters most
The single most important branch point here is Step 2 — confirming whether the executable exists anywhere on the system at all. Every subsequent step (PATH, extensions, COMMAND.COM health) only makes sense to investigate once you know the actual program is present somewhere; skipping straight to configuration troubleshooting for a program that was never installed in the first place wastes time on the wrong layer of the problem entirely.