Answers for "bat file wait for a few seconds"

1

how to wait for seconds in batch file

Windows version: w10
Set LoopVar to whatever number you want.
Not exactly 1 second per loop but roughly 1 second.
This will count down till it hits zero 

the below example waits for 3 seconds and counts down to 1 (not zero) 
--------------------------------CODE---------------------------------
@echo off

set LoopVar=3
:Loop
PING localhost -n 2 >NUL

::/ optional line
echo %LoopVar%

set /a LoopVar=%LoopVar%-1
if not %LoopVar%==0 goto Loop

::/ optional line
pause
----------------------------------------------------------------------

below is simplifed delay without extra bits for pasting convence :)
----------------------------------------------------------------------
@echo off

set LoopVar=3
:Loop
PING localhost -n 2 >NUL
echo %LoopVar%
set /a LoopVar=%LoopVar%-1
if not %LoopVar%==0 goto Loop
Posted by: Guest on February-28-2021

Code answers related to "bat file wait for a few seconds"

Browse Popular Code Answers by Language