Thomas' Tech Tips

How to sleep for X seconds in a Windows batch file

6 October 2023 - Thomas Damgaard

The timeout command can be used similar to Linux’s sleep command.

Example:

timeout 10

This will sleep 10 seconds.

Please note that timeout is not very accurate. timeout N will typically sleep anywhere between N and N-1 seconds.

How to measure accuracy:

@echo off
echo %time%
timeout 5 > NUL
echo %time%
Filed under: batch, howto, tips, windows

Back to article list