日期:2014-05-20 浏览次数:21029 次
import java.io.BufferedReader; import java.io.InputStreamReader; public class ListAllFiles { public static void main(String[] args) { try { Process pro = Runtime.getRuntime() .exec("cmd /c ipconfig /all"); InputStreamReader isr = new InputStreamReader(pro.getInputStream()); BufferedReader br = new BufferedReader(isr); String str = br.readLine(); while(str!=null){ System.out.println(str.trim()); str = br.readLine(); } br.close(); isr.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }