Home
» PC Tips
»
Instructions to fix the error “not recognized as an internal or external command” when using CMD in Windows
Instructions to fix the error “not recognized as an internal or external command” when using CMD in Windows
Yes, this case happens very often, especially for those who install many programs, programming applications such as Java, set up their own servers... which directly affects the Windows Environment. That is the error:
'cmd command syntax' is not recognized as an internal or external command, operable program or batch file.
This error phenomenon is that if you type any command syntax into CMD - Windows Command, such as Ping, ipconfig... you will receive the above error message.
So how to fix this error "is not recognized as an internal or external command...". Please refer to the article below of WebTech360!
What causes this "is not recognized as an internal or external command..." error on Windows?
As mentioned above, this error occurs when you install programs that affect the Windows Environment Variables section such as programming applications, server creation... When these environment variable values change, it will cause "misunderstanding" or confusion when Windows executes a program or command.
How to fix the error "is not recognized as an internal or external command...":
Verify that the program is installed
Verify that the program is installed
Command Prompt cannot run a program that does not exist. If you are trying to run a newly installed program, make sure it was installed correctly.
To verify the installation:
1. Press Win + R to open Run . Then type control and click OK.
2. Then, in Control Panel , go to Programs > Programs and Features .
3. Scroll through the list of installed apps and find the one you want to run.
Alternatively, you can also view installed apps by going to Apps and Features in Settings. To do this, press Windows key + I , click Apps and find the installed app.
By default, when you try to launch a program or a script from CMD, the command prompt looks for relevant files and paths in the System32 folder or environment variables. If the file is missing, it returns an error "is not recognized as an internal or external command, operable program or batch file".
This may be because Windows does not install most applications in the System32 folder, but instead in C:\Program Files.
You can solve this problem in three ways:
1. First, use the full path of the executable file to launch the program.
2. Second, add the program path to the Windows environment variables.
3. Finally, move the files to the System32 folder.
Use full file path to execute command
Use full file path to execute command
First, let's try the full path method. Here, we'll use the full file path instead of the application name to launch programs from Command Prompt. Here's how to do it:
2. Next, enter the full path of the application you want to launch. For example, if you want to open ESBCalc Port located in the C:\ folder , the command to open the application with the full path would look like this:
C:\ESBCalcPort.exe
3. However, this will only work if the file path does not have any spaces. If your file path has spaces, enter the file path inside double quotes.
Use full file path in quotes
Use full file path in quotes
Command Prompt reads spaces at the end of a command and treats anything after the space as a separate command.
Suppose you want to launch the Internet Explorer application in C:\Program Files\Internet Explorer\iexplore.exe via CMD. However, running this file path returns an error due to the space between Program Files and Internet Explorer .
To avoid this, you can enclose the file path in double quotes. Here, the command to launch Internet Explorer would look like this:
"C:\Program Files\Internet Explorer\iexplore.exe"
Add file path to Windows Environment Variables
You can edit the Environment Variables and add the application's file path to its folder. This way, Command Prompt will determine the path for the entered command and execute it without error.
Adding the full file path to Windows Environment Variable can help you resolve the “not recognized as an internal or external command” error for Flex, nmake, make, cobra, Is, terraform, gcc, code, Android Studio, Python, Fastboot, and ADB commands.
3. Go to System and Security > System . In the left pane, click Advanced System Settings .
Click Advanced System Settings
4. On newer versions of Windows 10, go to Settings > System > About . Then, click Advanced system settings under Related settings.
5. In the Advanced tab , click the Environment Variables button.
Click the Environment Variables button
6. In the new window, under System variables , select the Path variable.
7. Click the Edit button.
8. In the Edit window , click New.
Click New
9. Here, you have to paste the file path of the program that you want to run from CMD. For example, if you want to run the Chrome browser located in C:\Program Files\Google\Chrome\Application, then the full path of the file will be like this:
C:\Program Files\Google\Chrome\Application
10. Click OK to add it to Environment Variables.
Then click OK on all open windows to save the changes.
Once you have added the new environment variable, open Command Prompt , type the program name and CMD will open it without any errors.
Move the file to the System32 folder
Move the file to the System32 folder
System32 is a protected system folder and it is protected for a good reason. When you try to run a program with admin rights, Command Prompt will look for the executable file in the System32 folder. However, since all programs are not installed in the System32 folder, you may get an error.
If you still want to run the program from CMD and don't want to type the full file path, you can move the program file to the System32 folder.
To move program files to the System32 folder:
1. Navigate to the installation folder for the program and copy all the files in the folder. Here, we will move the Google Chrome files located in C:\Program Files\Google\Chrome\Application to the System32 folder.
2. Next, navigate to the C:\Windows\System32 folder and paste the copied files. Click Yes if the UAC prompt appears.
3. Next, open Command Prompt with admin rights, type chrome and press Enter. CMD will immediately open Google Chrome browser .