0
可能重複:
How do you list all processes on the command line in Windows?列表中的任務管理器進程
我想列出像使用Java任務管理器 「中svchost.exe」, 「explorer.exe的」 所有進程。 如果可能,我還想知道每個進程使用的內存量。
我希望能有一個純Java的解決方案,從this question
可能重複:
How do you list all processes on the command line in Windows?列表中的任務管理器進程
我想列出像使用Java任務管理器 「中svchost.exe」, 「explorer.exe的」 所有進程。 如果可能,我還想知道每個進程使用的內存量。
我希望能有一個純Java的解決方案,從this question
調整命令行的答案如果你是窗口
Process proc = Runtime.getRuntime().exec ("tasklist.exe");
InputStream Outputp = proc.getInputStream();
if(proc.waitFor() ==0){...//print Outputp}
的Linux: -
Process proc = Runtime.getRuntime().exec ("ps -A");
運行' tasklist'使用'Runtime.exec' – adatapost