日期:2014-05-20 浏览次数:20693 次
Runtime r=Runtime.getRuntime();
Process p=r.exec("cmd /C tasklist");
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream(),"gbk"));//windows的默认系统中文编码是gbk所以从cmd控制台的信息已gbk来解码
String line=null;
while((line=reader.readLine())!=null)
System.out.println(line);