For now, want to perform window command repeatedly every half second, already try to below code, but only perform every one second, how to reduce time interval to half second?
FOR /L %%A IN (1,1,10) DO ( echo i am here )
Windows timer commands such as timeout
and waitfor
measure their wait periods in seconds. The only native batch command capable of delaying fractions of a second (without relying on another scripting engine) is ping
. If you ping
an intentionally erroneous address one time with a -w
ait parameter of 500, you'll wait 500 milliseconds. Example:
for /L %%I in (1,1,10) do (
ping -n 1 -w 500 169.254.1.1 >NUL 2>NUL
echo And I would wait 500 milliseconds, and I would wait 500 more...
)
It seems that half-seconds are as fine as ping
understands. Whatever -w
ait value you specify is floored to the preceding half second. Setting -w 999
will wait half a second. Setting -w 1750
will wait 1.5 seconds.