您的位置:首页 > 其它

一个简单的调用脚本文件的例子

2012-09-18 10:55 302 查看
啥也不说了,直接贴代码


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();

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐