How To Fix ‘is not recognized as an internal or external command’ Errors
If you’re coming up against app or command ‘is not recognized as an internal or external command’ errors when trying to do something in the command line, update an app or install something new, you’re not alone. It happens when Windows environmental variables are changed which prevent the command being run.
You could literally be trying to do anything, even running a basic CMD command or updating your antivirus. If the variable has changed, Windows will not be able to execute that command. If this is happening to you, there are a couple of ways to handle it.
There are two versions of this error. One for general programs and one for if you’re trying to use a CMD command. I’ll show you how to fix both.
Fix ‘command is not recognized’ errors
The error syntax will usually be something like ‘Program.exe is not recognized as an internal or external command’. The syntax depends on what you’re doing at the time which is important as we have to check the installation file before we do anything else.
- Navigate to the installation file of the program you are trying to use and make sure the executable is present.
- Navigate to Control Panel, System and Security and Advanced system settings.
- Select the Environmental Variables button.
- Select Path in the System variables pane at the bottom of the new window.
- Select Edit and a new window will appear.
- Make sure ‘%SystemRoot%System32’ and ‘C:WindowsSystem32’ are present.
- Copy one value to Notepad.
- Change the entry in the Environmental Variable window to something else and click OK.
- Replace the value you just changed with the original from Notepad and click OK.
- Do the same for the other value.
If you know Windows, you will know that sometimes all you need do is re-enter a value for it to be picked up again. I assume this is to link it within the Windows internal database once more but who knows.
Pasting the values into Notepad saves time and preserves the correct syntax should you be disturbed while performing this task or in case you forget what it looked like. Just cut and paste each one individually and change the value in the Environmental variables to anything. Then paste the original value back and confirm. This should be enough for the original command you were trying to work again.
The eagle eyed among you may notice that ‘%SystemRoot%System32’ and ‘C:WindowsSystem32’ point to the same location. This is a legacy entry for those using older systems. Arguably you don’t need both but Windows still seems to reference them separately. Systemroot was mainly for systems that used both WINNT and Windows folders which is no longer true. However both need to be present even in Windows 10.
Fix ‘CMD command is not recognized’ errors
If you’re trying to run a CMD command and are seeing ‘CMD is not recognized as an internal or external command’, that could be something different. Trying the above fix may work but the issue may be being caused by a couple of registry entries that are interrupting the normal chain of commands.
Somehow, if you have AutoRun set in the registry, certain CMD commands such as ping or nslookup won’t always work. They return the error above. The .exe is present and everything may look correct, but these two small entries are ruining your day.
Those registry entries are:
This issue is at least a decade old. I have a bookmark for an MSDN blog entry from 2007 that I have saved illustrating this very thing.
- Navigate to C:WindowsSystem32 and make sure the CMD executable is present.
- Perform the Environmental variables check as above. If that doesn’t fix it move on.
- Run the command ‘cmd /d’ which apparently stops autorun from running. If the message is the same, move on.
- Find those two registry entries listed above and delete them.
This fix is old but gold. I used to use this when I worked IT Admin at a well-known cable company. That is why I still have it as a bookmark. The ‘command is not recognized as an internal or external command’ error has been around that long and as far as I know, the fix is still the same even five generations of Windows later. Nevertheless, if you do come across the error, at least you now know what to do.
When was the last time you saw the ‘is not recognized as an internal or external command’ error in Windows? Did you use one of these solutions or something else?