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

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 Files\SpeedFan\SpeedFan.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 OFF

SET EXEName=SpeedFan.exe
SET EXEFullPath=C:\Program Files\SpeedFan\SpeedFan.exe

TASKLIST | FINDSTR /I "%EXEName%"
IF ERRORLEVEL 1 GOTO :StartSpeedFan
GOTO :EOF

:StartSpeedFan
START "" "%EXEFullPath%"
GOTO :EOF