I still have this:
public static void main(String[] args) { try { String line; Process p = Runtime.getRuntime().exec( System.getenv("windir") + "\\system32\\" + "tasklist.exe"); BufferedReader input = new BufferedReader(new InputStreamReader( p.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line);
}
I want to be able to kill the PID-based process that the user enters. How can i do this? (You only need to work with Windows). * NB: Must be able to kill any process, incl. SYSTEM, so I assume that the -F flag is needed to use taskkill.exe?
So, if I had
Runtime.getRuntime().exec("taskkill /F /PID 827");
how can i replace "827" with my tokill variable?
source share