Windows Task Scheduler: Program Dependency
Go to solution
Solved by fizzlesticks,
As far as I know there is no way to not start program A if B isn't running, the closest you could get is killing A as soon as possible.
Here's a batch file that can be started from task scheduler on system startup and be run in the background that will only let Chrome run if Firefox is running.
@[member=Echo] off:start set aRunning=0 set bRunning=0 tasklist /FI "IMAGENAME eq firefox.exe" 2>NUL | find /I /N "firefox.exe">NUL if "%ERRORLEVEL%"=="0" set aRunning=1 tasklist /FI "IMAGENAME eq chrome.exe" 2>NUL | find /I /N "chrome.exe">NUL if "%ERRORLEVEL%"=="0" set bRunning=1 if %bRunning% == 0 goto endloop if %aRunning% == 1 goto endloop taskkill /im chrome.exe echo "Killed chrome.exe" :endloop timeout /t 5 /nobreak >NUL goto start
edit: And when I say only let Chrome run if Firefox is running, I mean Chrome will always start then die 0-5 seconds later if Firefox isn't running.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now