how to kill an application is not responding

January 7, 2011 at 01:56:04
Specs: Windows XP
I want to know how can I kill (or check an application is not responding). I've tried with the tasklist and taskkill commands but those check the proccess not the applications.

I want to mean, I have got an application which sometimes gets down and I have to kill and get up it. When the application is not running I use ' tasklist /v | find "myApp.exe" ' and the 'myApp.exe'' status process is "Running" so its service is not running.

Attach my batch programming to explain better:

for /F "tokens=1,2,6,7 delims=," %%a in ('tasklist -V -NH -FO CSV ^| find "%1"') do (
if /I "%%~c"=="Not responding" set colgado=true
if "%colgado%"=="true" (
taskkill /PID %%~b 2>NUL 1>NUL
start %programa%
goto end

Thanks so much for all.

See More: how to kill an application is not responding

Report •

January 7, 2011 at 02:40:09
Expansion issue:

Regardless of that you don't even need the variable:

if /I "%%~c"=="Not responding"  (
    taskkill /PID %%~b 2>NUL 1>NUL
    start %programa%

Report •

January 7, 2011 at 03:20:29
I mainly wanna make that when my app is blocked (called Not responding by Windows in its form) my batch program detects it and kills it.

So, the problem is I only find tasklist and taskkill batch command. Those commands show me that the process is Running, but the Application (is an non-comercial applicaction) is Not Responding (I can see it in the Task Manager) but the tasklist command says that the status is "Running".

I am trying to know if I forget some tasklits property or if I can use other commands which can help me.

Thank you other time!

Report •

January 7, 2011 at 08:06:01
There is no completely reliable method of determining if a process is running or hung. Has the process hung or is it simply busy and not able to respond at this time? There is no reliable way to determine this, at least not without inside knowledge of how the process works. Task Manager and tasklist are likely using different methods of doing this and thus give different results.

For most practical purposes an application and process are the same thing. An application may consist of more than one process but this association is managed by the application itself and may or may not be known to Windows.

Report •
Related Solutions

Ask Question