我需要执行一个批处理文件(在 Java 6 中)并为此使用以下代码:
final String command = "C:\Ruby191\bin\mygem.bat inputfile.dat";
final File parent = new File(aParentDir);
Process proc;
proc = aRuntime.exec(command, null, parent);
但我得到了这个例外:
...Exception: java.io.IOException: Cannot run program "
C:\Ruby191\bin\mygem.bat" (in directory "src\test\resources\...
"): CreateProcess error=267, Directory name invalid
有问题的批处理文件存在于指定目录中。
我的代码有什么问题?