Restart crashed program?

E

Evren

I have a program crashing sometimes. I need a program or something checking
if this program is running and and if not start the program..


Evren
 
J

Jerold Schulman

I have a program crashing sometimes. I need a program or something checking
if this program is running and and if not start the program..


Evren

Download PsList from http://www.sysinternals.com/utilities/pslist.html
Schedule the following, assuming your program is called program.exe in folder "C:\program files\my programs"

@echo off
setlocal
cd /d "C:\program files\my programs"
:again
@ping -n 61 127.0.0.1>nul
set OK=N
for /f "Tokens=1" %%a ('pslist^|find /i "program"') do (
set OK=Y
)
if "%OK%" EQU "Y" goto again
start /min "C:\program files\my programs\program.exe"
goto again



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top