Created
March 27, 2012 22:24
-
-
Save rberrelleza/2220972 to your computer and use it in GitHub Desktop.
Script that blocks the command line until process starts running
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set loops=0 | |
set process=%1 | |
:WaitForProcessToStart | |
if /i %loops% gtr 10 ( | |
echo Process didn't started on time | |
exit /b 1 | |
) | |
set /a loops=loops+1 | |
echo Waiting for %process% to start | |
tasklist | findstr %process% > nul | |
if "%ERRORLEVEL%"=="0" goto :ProcessStarted | |
REM Wait for 1 second between iterations | |
ping 1.1.1.1 -n 1 -w 5000 > nul | |
goto :WaitForProcessToStart | |
:ProcessStarted | |
echo Process started, waiting for 20 seconds | |
ping 1.1.1.1 -n 1 -w 20000 > nul | |
exit /b 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment