How to sleep for 5 seconds in Windows Command Prompt?

rem ******** Sleep for 5 seconds ********
ping -n 6 127.0.0.1 > nul
rem **************************************

127.0.0.1 : is the localhost IP address.

-n 6 : there is a 1s delay between each ping, so for a 5s delay you need to do 6 pings.

> nul : suppress the output.

 

@echo off
echo %time%
timeout 5 > NUL
echo %time%

 

posted @ 2018-06-06 13:55  天体风雪  阅读(147)  评论(0编辑  收藏  举报