JAVA执行VBA脚本

来源:互联网 发布:华润网络校园招聘2017 编辑:程序博客网 时间:2024/06/16 08:35
代码,直接COPY修改即可
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();
}
原创粉丝点击