Windows running application list using Java

前端 未结 4 806
醉梦人生
醉梦人生 2020-12-18 10:51

How to get Windows running application list using Java?I got to get the processlist.

4条回答
  •  春和景丽
    2020-12-18 11:31

    I would recommend also using the qprocess utility, then, if you need more info about a process, use wmic.

    Example :

    String line;
    try {
            Process proc = Runtime.getRuntime().exec("wmic.exe");
            BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
            OutputStreamWriter oStream = new OutputStreamWriter(proc.getOutputStream());
            oStream .write("process where name='explorer.exe'");
            oStream .flush();
            oStream .close();
            while ((line = input.readLine()) != null) {
                System.out.println(line);
            }
            input.close();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    

    See http://ss64.com/nt/wmic.html or http://support.microsoft.com/servicedesks/webcasts/wc072402/listofsampleusage.asp for some example of what you can get from wmic...

提交回复
热议问题