Windows Task Scheduler, run task if task isn’t running?

How do I ensure a task is running all the time?

I use speedfan to control my fans and on occasion it crashes or it needs to be restarted. If I manually quit speedfan because it isn’t working correctly it doesn’t reopen automatically.

How can I use the Task Scheduler to ensure it always runs, even if it isn’t running?

Currently it is set to run everytime I log on and is set to restart if the task fails but it still isn’t reopening.

Thanks

Solution:

Task Scheduler – run task if it isn’t running

You can use a batch script similar to the below and use Tasklist and FindStr to check whether or not the EXE name of SpeedFan is running in memory. With the below logic it’ll Start the EXE if is not found running in memory.


Batch Script Example

Be sure to replace the SpeedFan.exe value with the actual name of the EXE file that runs when you launch the app and it’s working properly if it’s something different in the SET EXEName=SpeedFan.exe.

You will need to ensure the full explicit path to the EXE is also in the below logic of what it actually is so just replace that (in the SET EXEFullPath=C:Program FilesSpeedFanSpeedFan.exe) with the real path of the app EXE; after the = sign is where you’ll change that.

Just scheduled this to run with Task Scheduler every 1 minute, 30 seconds, or however often you’d like this process to check if it’s running or not and if not to then start it.

@ECHO OFFSET EXEName=SpeedFan.exeSET EXEFullPath=C:Program FilesSpeedFanSpeedFan.exeTASKLIST | FINDSTR /I "%EXEName%"IF ERRORLEVEL 1 GOTO :StartSpeedFanGOTO :EOF:StartSpeedFanSTART "" "%EXEFullPath%"GOTO :EOF