Java调用bat文件和exe文件

 public static void main(String[] args) { 
    Runtime rt = Runtime.getRuntime(); 
    try {        
      String file = "E:/eclipse/workspace/pack/test.bat"; 
      rt.exec("cmd.exe /c start " + file); 
    } catch (IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
    } 
  }

猜你喜欢

转载自1028826685.iteye.com/blog/2270013