Windows的一大优点是您可以通过计算机上的命令提示符完成许多任务(get many of your tasks done from the Command Prompt)。您只需要输入cmd.exe,Windows就会为您运行它。但偶尔,您可能会遇到诸如“不被识别为内部命令”之类的错误。
这实际上是您在使用命令提示符(Command Prompt)时可能遇到的最常见错误之一。正如错误本身所暗示的那样,它无法识别您尝试与Command Prompt一起使用的工具。它发生的原因有多种,还有多种方法可以解决 Windows PC 上的“不被识别为内部或外部命令”错误。
为什么会出现“不被识别为内部命令”错误(Why The “not recognized as an internal command” Error Occurs)
在开始应用修复之前,最好了解错误发生的原因,这样您就可以确保将来不会再次发生错误。
其他应用程序弄乱你的系统(Other Apps Messing Up Your System)
您可能在 PC 上收到此错误的最常见原因之一是因为另一个安装的应用程序修改了您的系统变量。这可以防止命令提示符(Command Prompt)识别启动其他应用程序或工具的命令。
没有在您的计算机上安装程序(Not Having The Program Installed On Your Computer)
出现“无法识别为内部或外部命令”的第二个可能原因是您的计算机上没有安装适当的程序。可能是安装程序未将应用程序文件安装在适当的位置,或者安装程序未启用使用命令提示符(Command Prompt)启动该工具。
修复 Windows 中的“不被识别为内部或外部命令”错误(Fixing The “not recognized as an internal or external command” Error In Windows)
不管是什么原因,都有一些方法可以修复此错误并让命令提示符(Command Prompt)识别您尝试使用的程序。
确保程序实际存在于您的 PC 上(Ensure The Program Actually Exists On Your PC)
首先要做的是验证您尝试使用命令提示符(Command Prompt)的程序是否确实存在于您的计算机上。您可能使用了一个虚假的安装程序,告诉您该程序已成功安装在您的计算机上,但这可能不是真的。
有一种简单的方法可以检查程序是否确实安装(check if the program is indeed installed)在您的机器上。
- 在 PC 上启动文件资源管理器(File Explorer)窗口。
- 前往以下路径。
C:\Windows\System32\
- 确保您尝试从命令提示符(Command Prompt)运行的可执行文件在此文件夹中可用。如果不是,则该程序可能未安装在您的计算机上。
以上不是检查计算机上是否安装程序的可靠方法。这是因为并非所有程序都将其文件保存在 Windows 的 System32 文件夹中。但是,它应该可以帮助您找到大多数程序。
使用可执行文件的完整路径(Use The Full Path To The Executable File)
“不被识别为内部命令”错误通常是因为计算机找不到您要求它启动的可执行文件。但是,您可以为它提供可执行文件的完整路径,(full path to your executable file)然后它应该能够毫无问题地运行它。
- 在 PC 上启动命令提示符窗口。(Command Prompt)
- 输入要使用的可执行文件的完整路径,然后按键盘上的Enter 。
- 例如,如果您尝试使用位于桌面上名为adb的文件夹中的(adb)adb.exe,您将键入如下内容。C:\Users\<username>\Desktop\adb\adb.exe
用双引号将文件路径括起来(Enclose The File Path With Double Quotes)
指定可执行文件的完整路径并不是万无一失的方法。如果使用不当,还可能导致“不被识别为内部或外部命令”错误。问题在于您在命令提示符(Command Prompt)窗口中指定的路径。
如果您的可执行文件的完整路径中有空格,则会导致错误。这是因为该实用程序无法识别空格,它使用直到第一个空格的字符作为程序名称。由于这不是正确的路径,您将收到上述错误。
您可以使用以下方法解决此问题。
- 在输入包含空格(无论是单个还是多个)的路径时,请用双引号将路径括起来。
- 然后,命令提示符(Command Prompt)会将整个路径识别为单个项目,并在您的计算机上适当地启动程序。
将文件移动到 System32 文件夹(Move The File To System32 Folder)
到目前为止,您知道当您尝试从命令提示(Command Prompt)实用程序运行可执行文件时,它会查看Windows安装的(Windows)System32文件夹,然后打开该文件(如果该文件在那里可用)。
如果您可以将可执行文件放在那里,然后从命令提示符(the Command Prompt)访问它会怎样?只要您在计算机上具有管理员访问权限,就可以执行此操作。
- 将可执行文件以及与之关联的所有其他文件复制到计算机上的以下文件夹中。
C:\Windows\System32 - 如果它已经打开,请关闭命令提示符并重新启动它。(Command Prompt)
- 输入(Enter)你的可执行文件的名字,不带任何路径,你会发现它启动成功了。
虽然此方法效果很好并可以帮助您修复计算机上的“不被识别为内部或外部命令”错误,但您可能需要谨慎使用它。
这是因为每次您想使用Command Prompt中的某些内容时,您都需要将适当的可执行文件放在System32文件夹中。最终,该文件夹会变大,并且您将在其中放置大量文件。
它也不适用于需要安装到特定目录的可执行工具。由于安装路径是在Windows Registry中定义的,因此您将无法将它们移动到System32文件夹中。
我们建议您仅在使用其他方法无法解决问题并且应用程序不需要安装时才使用此解决方案。
将可执行文件路径添加到环境变量(Add The Executable File Path To Environment Variables)
修复“不被识别为内部命令”错误的最有效方法是编辑您的环境变量并在那里添加适当的文件路径。这是因为命令提示(Command Prompt)实用程序会在您输入命令时查看这些路径,然后如果在其中一个目录中找到该文件,则打开该文件。
通过在此处添加文件路径,当您想在CMD(CMD)窗口中通过其短名称使用某个可执行文件时,您将告诉命令提示符其所在的位置。(Command Prompt)
编辑变量并在那里添加新路径非常容易。
- 使用 PC 上的Cortana搜索启动控制面板。(Control Panel)
- 单击显示System and Security的选项。
- 从屏幕左侧边栏中选择高级系统设置。(Advanced system settings)
- 屏幕上将打开一个框。单击(Click)位于框底部的环境变量按钮。(Environment Variables)
- 您将看到您帐户的所有用户变量。单击显示(Click)路径(Path)的那个,然后单击编辑(Edit)按钮。
- 您现在可以将新路径添加到要与命令提示符(Command Prompt)一起使用的应用程序。单击(Click)右侧边栏中的浏览(Browse)以将目录添加到列表中。
- 导航到可执行文件所在的文件夹并选择它。
- 您应该会看到新添加的路径列在变量列表中。单击(Click)底部的确定以保存更改。(OK)
- 在所有其他框中单击确定,然后关闭它们。(OK)
- 打开命令提示符(Command Prompt)窗口并键入可执行文件的名称。您会看到文件打开时没有CMD在屏幕上抛出任何错误。
“不被识别为内部命令”错误有时会非常令人沮丧,因为它不会让您使用您知道已安装在计算机上的程序。
使用上述方法,您应该能够摆脱此错误并从命令提示符(Command Prompt)窗口运行任何程序而不会出现任何问题。如果上述任何方法帮助您解决了问题,我们希望在下面的评论部分中了解它。
How to Fix “not recognized as an internal or external command” in Windows
One of the great things about Windows is that you can get many of your tasks done from the Command Prompt on your machine. You just need to enter cmd.exe and Windows will run it for you. But occasionally, you might come across errors like “is not recognized as an internal command”.
This is actually one of the most common errors you can face with the Command Prompt. As the error itself suggests, it couldn’t recognize the tool you were trying to use with the Command Prompt. There are various reasons why it happens, and also there are multiple ways to get around the “not recognized as an internal or external command” error on your Windows PC.
Why The “not recognized as an internal command” Error Occurs
Before you start applying fixes, it’s a good idea to learn why the error occurred so you can ensure it doesn’t happen again in the future.
Other Apps Messing Up Your System
One of the most common reasons you may get this error on your PC is because another installed app modified your system variables. This prevents the Command Prompt from recognizing commands to launch other apps or tools.
Not Having The Program Installed On Your Computer
The second possible reason the “not recognized as an internal or external command” occurs is that you don’t have the appropriate program installed on your computer. It may be that the installer didn’t install the application files at the appropriate location, or the installer didn’t enable the tool to be launched with Command Prompt.
Fixing The “not recognized as an internal or external command” Error In Windows
Regardless of the cause, there are ways to fix this error and get the Command Prompt to recognize the program that you’re trying to use.
Ensure The Program Actually Exists On Your PC
The first thing to do is verify if the program that you’re trying to use with the Command Prompt actually exists on your computer. You may have used a fake installer that told you that the program was successfully installed on your machine, but that may not be true.
There’s an easy way to check if the program is indeed installed on your machine.
- Launch a File Explorer window on your PC.
- Head over to the following path.
C:\Windows\System32\
- Ensure the executable that you’re trying to run from the Command Prompt is available in this folder. If it’s not, the program is likely not installed on your computer.
The above isn’t a surefire way to check if a program is installed on your computer. This is because not all programs keep their files in the Windows’ System32 folder. However, it should help you locate most programs.
Use The Full Path To The Executable File
The “is not recognized as an internal command” error usually occurs because the computer can’t find the executable that you’re asking it to launch. However, you can provide it with the full path to your executable file and it should then be able to run it without any issues.
- Launch a Command Prompt window on your PC.
- Type in the full path of the executable that you want to use and hit Enter on your keyboard.
- For example, if you’re trying to use adb.exe that’s located in a folder called adb on your desktop, you’ll type something like the following.
C:\Users\<username>\Desktop\adb\adb.exe
- The file should launch without an issue.
Enclose The File Path With Double Quotes
Specifying the full path to your executable file isn’t a bulletproof method. It can also cause the “is not recognized as an internal or external command” error if it isn’t used properly. The problem lies in the path that you specify in your Command Prompt window.
If your executable file’s full path has any spaces in it, that’s going to cause the error. This is because the utility can’t recognize the spaces, and it uses the characters up to the first space as a program name. Since that isn’t the correct path, you’ll get the aforementioned error.
You can fix this using the following method.
- While typing in a path that has spaces (whether single or multiple), enclose the path with double quotes.
- Command Prompt will then recognize the entire path as a single item and launch the program appropriately on your machine.
Move The File To System32 Folder
By now, you know that when you try to run an executable from the Command Prompt utility, it looks into the System32 folder of your Windows installation and then opens the file, if it’s available there.
What if you could place your executable file there and then access it from the Command Prompt? You can do this as long as you have admin access on your computer.
- Copy the executable file along with all other files associated with it to the following folder on your computer.
C:\Windows\System32 - Close Command Prompt if it was already open and relaunch it.
- Enter the name of your executable file without any path, and you’ll find it launches successfully.
While this method works great and helps you fix the “is not recognized as an internal or external command” error on your computer, you may want to use it cautiously.
This is because each time you want to use something from the Command Prompt, you’ll need to put the appropriate executable in the System32 folder. Eventually, the folder will grow large and you’ll have a large number of files sitting in there.
It also won’t work for executable tools that require installation into a specific directory. You won’t be able to move those into the System32 folder since the installation path is defined in the Windows Registry.
We recommend you only use this solution if you can’t fix the issue using the other methods and as long as the application doesn’t require installation.
Add The Executable File Path To Environment Variables
The most efficient way to fix the “is not recognized as an internal command” error is to edit your environment variable and add the appropriate file path there. This is because the Command Prompt utility looks at those paths when you enter a command, and then opens the file if it finds it in one of those directories.
By adding your file path there, you’re telling Command Prompt where a certain executable is located when you want to use it by its short-name in a CMD window.
It’s pretty easy to edit your variables and add a new path there.
- Launch Control Panel using the Cortana search on your PC.
- Click on the option that says System and Security.
- Find and click on System on the following screen.
- Select Advanced system settings from the left sidebar on your screen.
- A box will open on your screen. Click on the Environment Variables button which is located at the bottom of the box.
- You’ll see all the user variables for your account. Click on the one that says Path and then click on the Edit button.
- You can now add the new path to the application you want to use with the Command Prompt. Click on Browse in the right sidebar to add a directory to the list.
- Navigate to the folder where your executable is located and select it.
- You should see your newly added path is listed in the variables list. Click on OK at the bottom to save the changes.
- Click on OK in all other boxes as you close them.
- Open a Command Prompt window and type the name of the executable file. You’ll see that the file opens without CMD throwing any errors on your screen.
The “is not recognized as an internal command” error can sometimes be very frustrating, as it won’t let you use a program that you know you’ve installed on your computer.
Using the methods above, you should be able to get rid of this error and run any program from a Command Prompt window without any issues. If any of the methods above helped you fix the issue, we’d like to know about it in the comments section below.