You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
472 B

@echo off
REM This script takes a command and retries it a few times if it fails, with a
REM timeout between each retry.
setlocal EnableDelayedExpansion
REM Loop at most n_retries times, waiting sleep_time times between
set sleep_time=60
set n_retries=5
for /l %%x in (1, 1, %n_retries%) do (
call %*
if not ERRORLEVEL 1 EXIT /B 0
timeout /t %sleep_time% /nobreak > nul
)
REM If it failed all n_retries times, we can give up at last.
EXIT /B 1