ms dos batch file

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

markde101

Thread Starter
Joined
Oct 9, 2008
Messages
9
Hi

i am trying to write a batch file... which looks at my active processors ever 5 minutes or so, if the application i choose is not running, the batch file should execute it automatically.

If the app is running it should not run it

Please assist
 
Joined
Apr 7, 2007
Messages
4,910
Welcome To TSG markde101

not the best way to do in batch.

Code:
::this batch will never quit.
@echo off
setlocal
 
:: Define operating environment
set app=notepad.exe
set Wait=300
 
:loop
::Verify Instance Running
tasklist |find /i "%app%" >nul
if not errorlevel 1 echo %app% is running
if errorlevel 1 start "" "%app%"
 
echo Monitoring: %app%
echo waiting:    %Wait% seconds
 
:wait
ping -n %Wait% localhost >nul
goto :loop
you can simply write a script which checks if the app is running , if not running then start it . then use scheduled task to run the script every 5 min.
 

markde101

Thread Starter
Joined
Oct 9, 2008
Messages
9
HI Devil himself

thanks for the speedy and spot on response...worked perfectly.Just need to get it to run in silent mode...then this baby is good to go.

Thanks again
 

markde101

Thread Starter
Joined
Oct 9, 2008
Messages
9
Hi Devil _himself

Sorry for the super delayed response

Just thought id let you know...the script you gave me works perfectly
Thanks very much for your assistance
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top