Now i have several same process activated in my system. Besides, although these process have same process name, they have different window title name. And sometimes i want to kill a specific window. If i kill process using process name, i may kill a process which should be alive. How can i solve this? How to kill a process using the window's name of this process? (Python or Bat if fine)
for example, if i kill process by process name:
import psutil
PROCNAME = 'server'
def kill():
for proc in psutil.process_iter():
if proc.name == PROCNAME:
proc.kill()
However, now i want to kill process by window's title name.
i have found the solution. i can use bat command like this:
taskkill /fi "WINDOWTITLE eq titleName"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With