O R G A N I C / F E R T I L I Z E R: how to use sleep or wait in a simple command execution

Jul 16, 2008

how to use sleep or wait in a simple command execution

well, the obvious is to use “sleep.exe”. what if you don’t have it available? this is something i ran into today when i was on a server, needed to loop through a log and keep searching for a value… and didn’t want to sit around waiting.

simply, this was the command i was trying to get to run:

for /l %a in (1,1,5000) do find /i “failure” myLog.log & sleep 10

this didn’t work because sleep.exe wasn’t there. so, i did what any good internet citizen would do: google. i came up with this link: http://malektips.com/dos0017.html.

it gives a couple of examples using choice and ping. since choice was available, i decided to try this. my constructed command became:

for /l %a in (1,1,5000) do choice /t 10 /d y >nul & find /i “failure” myLog.log

now i get a 10 second delay between each loop. :)