How do I make a batch file wait / sleep for some seconds?
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Horror Game Menu Looping
--
Chapters
00:00 How Do I Make A Batch File Wait / Sleep For Some Seconds?
00:28 Accepted Answer Score 34
00:49 Answer 2 Score 2
01:05 Answer 3 Score 163
01:33 Answer 4 Score 11
01:37 Thank you
--
Full question
https://superuser.com/questions/48231/ho...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows7 #windows #batch #sleep
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Horror Game Menu Looping
--
Chapters
00:00 How Do I Make A Batch File Wait / Sleep For Some Seconds?
00:28 Accepted Answer Score 34
00:49 Answer 2 Score 2
01:05 Answer 3 Score 163
01:33 Answer 4 Score 11
01:37 Thank you
--
Full question
https://superuser.com/questions/48231/ho...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows7 #windows #batch #sleep
#avk47
ANSWER 1
Score 163
You can use the timeout
command:
This utility accepts a timeout parameter to wait for the specified time period (in seconds) or until any key is pressed. It also accepts a parameter to ignore the key press.
For example, to wait for 10 seconds:
TIMEOUT /T 10
For more details:
TIMEOUT /?
ACCEPTED ANSWER
Score 34
There are many sleep utilities you can download and drop into your System32 folder, one is provided with the Windows Server 2003 Resource Kit called sleep.exe
.
You can also use the ping trick:
:sleep
ping 127.0.0.1 -n 2 -w 1000 > NUL
ping 127.0.0.1 -n %1 -w 1000 > NUL
then from somewhere in your batch file, you can call it like so:
CALL :sleep 1
ANSWER 3
Score 11
timeout /t <seconds> /nobreak > NUL
ANSWER 4
Score 2
sleep.exe is included in the Windows Server 2003 Resource Kit Tools.
You may use:
sleep /?
sleep seconds
sleep -m milliseconds