我一直在尝试运行批处理命令来打开批处理文件,但似乎无法找到该位置。我得到的错误是
" Windows找不到' C:Program'确保正确输入名称"
这是批次中的原始行
call testrunner.bat -a -f"W:\WebServices Migration Project\crp5\regression results" "W:\WebServices Migration Project\crp5\soapui-project.xml"
Java代码
Process process = Runtime.getRuntime().exec("cmd /c start C:\\Program Files\\SmartBear\\SoapUI-5.2.1\\bin\\testrunner.bat -a -f'W:\\WebServices Migration Project\\crp5\regression results' 'W:\\WebServices\\crp5\\soapui-project.xml'");
答案 0 :(得分:0)
这是在文件路径中占用空间的问题。尝试:
Process process = Runtime.getRuntime().exec("cmd /c start "C:\\Program Files\\SmartBear\\SoapUI-5.2.1\\bin\\testrunner.bat" -a -f'W:\\WebServices Migration Project\\crp5\regression results' 'W:\\WebServices\\crp5\\soapui-project.xml'");
答案 1 :(得分:0)
您的路径有空格:
Process process = Runtime.getRuntime().exec("cmd /c start C:\\Program Files\\SmartBear\\SoapUI-5.2.1\\bin\\testrunner.bat -a -f'W:\\WebServices Migration Project\\crp5\regression results' 'W:\\WebServices\\crp5\\soapui-project.xml'");
^
因此,您尝试使用参数C:\Program
运行名为Files\SmartBear\etc...
的程序。路径需要引用:
Process process = Runtime.getRuntime().exec("cmd /c start \"C:\\Program Files\\SmartBear\\SoapUI-5.2.1\\bin\\testrunner.bat\" -a -f'W:\\WebServices Migration Project\\crp5\regression results' 'W:\\WebServices\\crp5\\soapui-project.xml'");
^^-----