我這裏有我的代碼片段:如何在Windows中獲取正在運行的應用程序的PID?
ArrayList<String> cmd_exec_installer = new ArrayList<String>();
cmd_exec_installer.add("file.exe");
Process proc = new ProcessBuilder(cmd_exec_installer).start();
我想要做的是讓進程的PID開始執行file.exe
。
有沒有辦法在Java中做到這一點?
謝謝! @alberto。我能夠獲得主進程的PID,但仍然無法殺死主進程的子進程。我仍然在尋找一個好的解決方案或者解決方法。 – prix