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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32035577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 11:57:24  来源:igfitidea点击:

'cmd' is not recognized as an internal or external command, operable program or batch file

javabatch-filemaven-3netbeans-8

提问by Drashti Pandya

When I build my project in netbeans me it shows:

当我在 netbeans 中构建我的项目时,它显示:

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

I'm using jdk 8 and maven 3.3. My path system variable is:

我正在使用 jdk 8 和 maven 3.3。我的路径系统变量是:

%SystemRoot%\system32;%SystemRoot%;D:\POS\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin;

采纳答案by orvi

So far I understand this is not your IDEissue.Check your "system32" is correctly defined in the PATH environment variable .

到目前为止,我明白这不是您的IDE 问题。检查您的“system32”是否在 PATH 环境变量中正确定义。

Path = %SystemRoot%\system32;

回答by Sasikumar Murugesan

you can get it worked in anyone of below ways

您可以通过以下任何一种方式使其工作

  1. Set path to system32 c:\windows\system32instead of %SystemRoot%\system32
  2. Go to system32 folder then search and find cmd.exe
  3. Use commandinstead of cmd.exe
  1. 将路径设置为 system32c:\windows\system32而不是%SystemRoot%\system32
  2. 转到system32文件夹然后搜索并找到 cmd.exe
  3. 使用command代替cmd.exe

回答by Arshad Ali

We can get cmd.exe with already setted System root path in very simple way

我们可以通过非常简单的方式获取已设置系统根路径的 cmd.exe

  1. simply copy cmd.exe from Windows/System32 folder and paste it in directory where it is needed.
  1. 只需从 Windows/System32 文件夹中复制 cmd.exe 并将其粘贴到需要它的目录中。

回答by Alien

One variable named Pathwas already set but i created a new variable which is PATHso it replaced the Pathvariable so Path = %SystemRoot%\system32;got deleted.

命名一个变量Path已经确定,但我创建了一个新的变量,它是PATH那么它取代的Path变量,因此Path = %SystemRoot%\system32;删除了。

SO the conclusion is you were trying to install java or maven and you replaced Path with PATH and its gone.

所以结论是你试图安装 java 或 maven,你用 PATH 替换了 Path 并且它消失了。

So set the SystemRoot path in environment variable something like below.

所以在环境变量中设置 SystemRoot 路径,如下所示。

PATH = %JAVA_HOME%\bin;%M2_HOME%\bin;%SystemRoot%\system32;

路径 = %JAVA_HOME%\bin;%M2_HOME%\bin;%SystemRoot%\system32;