解决java执行 cmd命令报错Exception in thread "main" java.io.IOException: Cannot run program "xxxx": CreateProcess error=2, The system cannot find the file specified

在需要执行的cmd命令头部添加“cmd.exe /c ”字符串,比如原来需要执行“start xxx.bat”,修改之后的命令为“cmd.exe /c start xxx.bat”;这样就可用例如

Runtime.getRuntime().exec(“cmd.exe /c start xxx.bat”);

  方法来启动它