Question schedul automatic start/stop of software

hmmmmm

Reputable
Mar 22, 2016
33
0
4,530
I need to automatically restart a .exe program that get's frozen for some unknown reason every 1-3 hours.

I followed the instructions on this site and it kinda of works... but the timing is off. I'm trying to get it to stop the software every 3 hours then start it immediately after (within 1-2 minutes) the program was stopped.

https://sumtips.com/how-to/automatically-start-and-close-programs-at-specific-time/

It works fine but the .exe is stopped but then it takes around 1-2 hours for it to start again instead of starting immediately after it was stopped. I'm not sure to how to set the time up so it does it the way I want.

I have it set so that the stop time is 3 hours and 5 min exactly after the start time, but it's not working (as described above.)

Thanks in advance!
 

hmmmmm

Reputable
Mar 22, 2016
33
0
4,530
Figured it out without the scheduler. I just created a bat file to loop and start and stop it at any given time frequency.


@Echo off
rem start and stop file1.exe every 1 hour automatically
:loop
cd insert file path here
start file1.exe
rem ****wait for 1 hour before returning to loop or recycle the process
timeout /t 3600
TASKKILL /F /IM file1.exe /T
rem ****Wait for 10 seconds before starting the program again
timeout /t 10
goto loop