I am trying to write a batch file that does two things:
You can also get rid of the hacky ping -n command by using timeout
.
Here's the answer of MC ND with timeout
. The 1
in the sample stands for 1 second.
:loop
for /f "tokens=2 delims=: " %%f in ('schtasks /query /tn yourTaskName /fo list ^| find "Status:"' ) do (
if "%%f"=="Running" (
timeout /T 1 /NOBREAK > nul
goto loop
)
)