5

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.

7

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.

1
  • Your second option worked perfectly for my purposes: every now and then my torrent program crashes as it runs out of memory. This keeps it running like a hot-damn! – jeranon Nov 24 '18 at 0:25
4

This 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.