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?
One hack is to (mis)use the ping command:
Explanation:
pingis a system utility that sends ping requests.pingis available on all versions of Windows.127.0.0.1is the IP address of localhost. This IP address is guaranteed to always resolve, be reachable, and immediately respond to pings.-n 6specifies that there are to be 6 pings. There is a 1s delay between each ping, so for a 5s delay you need to send 6 pings.> nulsuppress the output ofping, by redirecting it tonul.