'' 不是内部或外部命令,也不是可运行的程序或批处理文件 [英] '' is not recognized as an internal or external command, operable program or batch file

查看:44
本文介绍了'' 不是内部或外部命令,也不是可运行的程序或批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试从 Windows cmd.exe 终端运行 mycommand.exe 时,我都会收到此错误:

<块引用>

''mycommand.exe' 不是内部或外部命令,也不是可运行的程序或批处理文件'

然后

当我尝试运行 C:Program FilesMy-AppMobile.exe

时,我也遇到了类似的错误<块引用>

''C:Program' 不是内部或外部命令,也不是可运行的程序或批处理文件'

解决方案

这是一个在 Stackoverflow 上很常见的问题.

这里的重要部分不是错误中显示的命令,而是实际错误告诉您的内容.

关于收到此错误原因的快速细分.

cmd.exe 作为终端窗口依赖于输入和系统环境变量,以便执行您要求它执行的操作.它不知道所有内容的位置,也不知道何时区分由空格分隔的命令或可执行名称,例如 spacetab 或带有空格的命令切换变量.

<块引用>

我该如何解决这个问题:

当实际命令/可执行文件失败时

首先我们要确定,可执行文件是否真的安装了?如果是,则继续其余的,如果不是,请先安装.

如果您有任何试图从 cmd.exe 运行的可执行文件,那么您需要告诉 cmd.exe 该文件所在的位置.有两种方法可以做到这一点.

  1. 指定文件的完整路径.

    "C:My_Filesmycommand.exe"

  2. 将文件的位置添加到您的环境变量中.

<块引用>

转到:
------>控制面板->系统->高级系统设置->环境变量

System Variables 窗口中,找到 path 并选择 edit

现在只需将您的路径添加到字符串的末尾,用分号分隔 ; 为:

;C:My_Files

保存更改并退出.您需要确保您打开的任何 cmd.exe 窗口都已关闭并重新打开,以允许它重新导入环境变量.现在您应该能够从 cmd.exe 中的任何路径运行 mycommand.exe,因为环境知道它的路径.

C:Program 或类似的失败

这是一个非常简单的错误.空格后的每个字符串在 cmd.exe 终端中都被视为不同的命令,您只需将整个路径用双引号括起来,以便 cmd.exe将其视为单个字符串,而不是单独的命令.

所以要执行 C:Program FilesMy-AppMobile.exe 只需运行为:

"C:Program FilesMy-AppMobile.exe"

Whenever I try and run mycommand.exe from my windows cmd.exe terminal, I get this error:

''mycommand.exe' is not recognized as an internal or external command, operable program or batch file'

Then

I also experienced a similar error when I tried to run C:Program FilesMy-AppMobile.exe

''C:Program' is not recognized as an internal or external command, operable program or batch file'

解决方案

This is a very common question seen on Stackoverflow.

The important part here is not the command displayed in the error, but what the actual error tells you instead.

a Quick breakdown on why this error is received.

cmd.exe Being a terminal window relies on input and system Environment variables, in order to perform what you request it to do. it does NOT know the location of everything and it also does not know when to distinguish between commands or executable names which are separated by whitespace like space and tab or commands with whitespace as switch variables.

How do I fix this:

When Actual Command/executable fails

First we make sure, is the executable actually installed? If yes, continue with the rest, if not, install it first.

If you have any executable which you are attempting to run from cmd.exe then you need to tell cmd.exe where this file is located. There are 2 ways of doing this.

  1. specify the full path to the file.

    "C:My_Filesmycommand.exe"

  2. Add the location of the file to your environment Variables.

Goto:
------> Control Panel-> System-> Advanced System Settings->Environment Variables

In the System Variables Window, locate path and select edit

Now simply add your path to the end of the string, seperated by a semicolon ; as:

;C:My_Files

Save the changes and exit. You need to make sure that ANY cmd.exe windows you had open are then closed and re-opened to allow it to re-import the environment variables. Now you should be able to run mycommand.exe from any path, within cmd.exe as the environment is aware of the path to it.

When C:Program or Similar fails

This is a very simple error. Each string after a white space is seen as a different command in cmd.exe terminal, you simply have to enclose the entire path in double quotes in order for cmd.exe to see it as a single string, and not separate commands.

So to execute C:Program FilesMy-AppMobile.exe simply run as:

"C:Program FilesMy-AppMobile.exe"

这篇关于'' 不是内部或外部命令,也不是可运行的程序或批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆