auto restart

I have an executable program that stops every once in awhile.  Then I have to double click it to start again.  Is there a way to auto restart this program?  It is on a windows 2012 server.  It does not have a service to start it.
mkramer777Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris MillardCommented:
How quickly do you notice that it has stopped? Can you start it using a scheduled task?
mkramer777Author Commented:
How would a scheduled task know to run the task when the program has stopped?
Chris MillardCommented:
Your scheduled task could be to run a batch file which first of all checks to see if the executable is already running, and if not, starts it...

http://stackoverflow.com/questions/162291/how-to-check-if-a-process-is-running-via-a-batch-script

Set the task to run as often as you want / need
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

mkramer777Author Commented:
Without reading everything on the link, what part can I copy and paste as a batch file that will start the executable if it sees it is not started?
Chris MillardCommented:
OK. Supposing you wanted to check for Outlook running, and if not then you wanted to start it. This is a batch file that I have created (and just tested):-

@echo off
tasklist /FI "IMAGENAME eq outlook.exe" 2>NUL | find /I /N "outlook.exe">NUL
if "%ERRORLEVEL%"=="0" goto programisrunning
start "" "C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"
exit
:programisrunning
echo Program Is Running

Open in new window


Save this code as something.cmd and then create a scheduled task to run that cmd file as often as you need.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mkramer777Author Commented:
I got it to work.  How would I set a schedule to run the task every hour?  Do I need to create a task for each hour?
Chris MillardCommented:
No - in the scheduled task trigger, you can specify that the task repeats every 1 hours
mkramer777Author Commented:
Worked perfectly.  Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2012

From novice to tech pro — start learning today.