我正在尝试远程执行 .bat 文件并实现以下代码行:
ProcessBuilder processBuilder = new ProcessBuilder(command);
final Process process = processBuilder.start();
InputStream stderr = process.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
process.waitFor();
System.out.println("Waiting ...");
System.out.println("Returned Value :" + process.exitValue());
但是我的程序卡在了while循环中。它显示的错误是:
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
它永远不会退出while循环。但它会成功执行脚本。任何形式的帮助表示赞赏。谢谢