首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

java施行.bat文件(收藏)

2012-10-26 
java执行.bat文件(收藏)原文? http://blog.csdn.net/gavin_sw/archive/2007/01/22/1489657.aspxtry{String

java执行.bat文件(收藏)

原文? http://blog.csdn.net/gavin_sw/archive/2007/01/22/1489657.aspx

try{
String exeBat = "c:\test.bat";
Process child = Runtime.getRuntime().exec(exeBat);
InputStream in = child.getInputStream();
BufferedReader br= new BufferedReader(new InputStreamReader(in));

String line = br.readLine().toString();
while(line!=null ){
??? System.out.println(line);? //输出测试
??? line = br.readLine().toString();
}

try{
??? child.waitFor();
??? br.close();
??? in.close();
}catch (Exception e) {
??? e.printStackTrace();
}
}catch (Exception e) {
??? e.printStackTrace();
}

热点排行