Windows – How to (what program) kill a process in Windows that has been inactive for X seconds and is running in multiple instances

killmultiple instancesprocesstaskswindows

I have multiple instances of a programm running and from time to time it stops responding.
I need to check if processes of X have not been responding for >X seconds, and if yes, kill this exact process – not all instances of X, but this special one.

Monitoring programms like Kiwi or Process Explorer can only shutdown either process with PID X or ALL instanced of process X.

Can anyone share a programm/script that gives me the ability to solve this problem ?

Closer information:
It is a game that i start on different accounts and sometimes the game fails to enter a session and simply stops responding, leading the account to be AFK ingame and simply wait until the session stops and then the account is queueing up again – when this happens often, there are penalties or even bans… If the account enters the session normally nothing goes wrong for anyone.

Best Answer

You can play around the script using :loop , goto loop and timeout exemple :
:loop
taskkill /im "League of Legends.exe" /fi "STATUS eq NOT RESPONDING"
timeout /t 5 /NOBREAK
goto loop

Related Question