How to sleep for five seconds in a batch file/cmd [duplicate]
IT Nursery
April 21, 2022
0
Windows’s Snipping tool can capture the screen, but sometimes I want to capture the screen after five seconds, such as taking an image being displayed by the webcam. (Run the script and smile at the camera, for example.)
How do I sleep for 5 seconds in a batch file?
30 s 30
I’m very surprised no one has mentioned:
C:\> timeout 5
N.B. Please note however (thanks Dan!) that timeout 5 means:
Sleep anywhere between 4 and 5 seconds
This can be verified empirically by putting the following into a batch file, running it repeatedly and calculating the time differences between the first and second echos: