how to pause 5 seconds in batch file code example

Example 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

Example 2: windows batch file wait 5 seconds

SLEEP X_NUMBER_SECONDS

Tags:

Misc Example