代码,直接COPY修改即可
try {
try {
String[] cpCmd = new String[]{"wscript", "E:/format.vbs"};
Process process = Runtime.getRuntime().exec(cpCmd);
int val = process.waitFor();//val 是返回值,如果返回0,那么正常执行。
System.out.println(val);
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}