Advertisement
Guest User

Kill any Process launched from CMD (Java code)

a guest
Sep 6th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. private static boolean kill(String input) {
  2. String cmd = "wmic Path win32_process Where \"CommandLine Like '%" + input + "%'\" Call Terminate";
  3.  
  4. Runtime run = Runtime.getRuntime();
  5. try {
  6. run.exec(cmd);
  7. return true;
  8. } catch (IOException e1) {
  9. e1.printStackTrace();
  10. }
  11. return false;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement