Answers for "how to wait 5 seconds in a batch file"

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
-1

windows batch file wait 5 seconds

SLEEP X_NUMBER_SECONDS
Posted by: Guest on February-19-2021

Browse Popular Code Answers by Language