简体   繁体   中英

Is it possible to kill a process based on process name using java?

Is it possible to kill a process based on process name using java in Windows? The process is not a java process. It is an exe.

尝试

Runtime.getRuntime().exec("taskkill /F /IM <processname>.exe")

Runtime.getRuntime().exec("taskkill /F /IM explorer.exe /T");
  • /F = Kill forcefully
  • /IM = Name of the Process/Image
  • /T = Kill any child processes as well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM