日期:2014-05-20 浏览次数:20722 次
Process proc = Runtime.getRuntime().exec("cmd.exe /C dir");
BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
StringBuilder result = new StringBuilder();
while (true) {
String str = reader.readLine();
if (str == null) {
break;
}
result.append(str).append("\n");
}
reader.close();
proc.destroy();
System.out.println(result.toString());