1@echo off 2REM This script takes a command and retries it a few times if it fails, with a 3REM timeout between each retry. 4 5setlocal EnableDelayedExpansion 6 7REM Loop at most n_retries times, waiting sleep_time times between 8set sleep_time=60 9set n_retries=5 10 11for /l %%x in (1, 1, %n_retries%) do ( 12 call %* 13 if not ERRORLEVEL 1 EXIT /B 0 14 timeout /t %sleep_time% /nobreak > nul 15) 16 17REM If it failed all n_retries times, we can give up at last. 18EXIT /B 1 19