I am having random Applications Freeze up, while I can easily end unresponded tasks with the batch file, I am trying to diagnose which applications are causing the problems. But I cannot Reference a task that has already been killed by PID. I would like the code to show offending Applications before or after killing the process.
This is what I've been using up till now, it does work and does show the PID. But it does not show the application name.
@echo off
:Start
taskkill /f /fi "status eq not responding"
TIMEOUT /t 30 /nobreak
goto Start
**This is what i've been trying to use to get the offending application name**
:Start
Set %processPID% = taskkill.exe /fi "status eq not responding"
wmic process where "ProcessID=%processPID% get CommandLine, ExecutablePath
taskkill.exe /f /fi "status eq not responding"
TIMEOUT /t 5 /nobreak
goto Start
This is what I get when running the new code
It appears that the variable processPID
is not being set.
C:\Users\razra\Desktop>Set = taskkill.exe /fi "status eq not responding" The syntax of the command is incorrect.
C:\Users\razra\Desktop>wmic process where "ProcessID= get CommandLine, ExecutablePath , - Invalid alias verb.