public static String excuteCommand(String command){ Runtime runtime = Runtime.getRuntime(); try { Process process = runtime.exec(command); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream(), Charset.forName("GBK"))); StringBuffer sb = new StringBuffer(); String inline; while(null != (inline = bufferedReader.readLine())){ sb.append(inline).append("\n"); } return sb.toString(); } catch (IOException e) { e.printStackTrace(); return null; }
执行DOS命令并返回结果
猜你喜欢
转载自www.cnblogs.com/wsy0202/p/11670005.html
今日推荐
周排行