Is there a tool that constantly checks, if another process is running, and if not, starts it? For Windows 7-10.
I have a background process running, a piece of free software I need. Even though it works great most of the time, sometimes it just crashes and disappears without further notice. Just restarting this software would solve my issue.
2 Answers
Using information from this question on Stack Overflow, you could create a .bat file like so (I've used Powerpoint as an example):
tasklist /FI "IMAGENAME eq POWERPNT.EXE" 2>NUL | find /I /N "POWERPNT.EXE">NUL if NOT "%ERRORLEVEL%" == "0" start "" "C:\Program Files\Microsoft Office\root\Office16\POWERPNT.EXE" You could then either create a scheduled task to run this every minute or however long you can go without the process running
Alternatively, you could launch the application in an infinite loop:
@echo off :1 "C:\Program Files\Microsoft Office\root\Office16\POWERPNT.EXE" goto :1 This would reopen the program as soon as it's closed.
1This is one of the things that you can do with AutoIt.
Create a small script that performs a check periodically. Something as simple as...
While True If (ProcessExists("prog.exe") = 0) Then Run("prog.exe") EndIf Sleep(1000) Wend ...or even...
While True RunWait("prog.exe") Wend ...or more complex if you wish.
The script can be compiled to an exe and run quietly in the background.