啥也不说了,直接贴代码
public static void callBat(String locationBat){ //参数为需要调用的脚本文件的路劲
try {
Process child = Runtime.getRuntime().exec("cmd.exe /C start "+locationBat);
InputStream in = child.getInputStream();
int c=0;
while ((c = in.read()) != -1) {
}
in.close();
try {
child.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("done");
} catch (IOException e) {
e.printStackTrace();
}
}