1
2
3
4
5
6
7
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)
windows下获取伏卜当前进程团厅谨的话可以用dos命令tasklistRuntime 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)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)