开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜