Simple program to restart another program on certain condition
Basically I need to restart a program if it quits with a value other than zero.
I believe it will be a simple program probably can be made wi开发者_开发知识库th a few lines of code in a BAT file. I'm wondering if someone has already written similar program and want to share it.
In Python:
import subprocess
while True:
rc = subprocess.call('program.exe')
if rc == 0:
break
This is a simple example in Batch:
:a
program.exe
IF NOT %ERRORLEVEL% EQU 0 GOTO a
精彩评论