延遲一段時間最常用的命令之一是 ping

基本用法

PING -n 1 -w 1000 1.1.1.1

REM the -n 1 flag means to send 1 ping request.
REM the -w 1000 means when the IP(1.1.1.1) does not respond, go to the next command
REM 1.1.1.1 is an non-existing IP so the -w flag can ping a delay and go to next command

這將在批處理檔案/控制檯上輸出以下內容:

C:\Foo\Bar\Baz>ping -n -w 1000 1.1.1.1

Pinging 1.1.1.1 (Using 32 bytes of data)
Request timed out

Ping statistics for 1.1.1.1
    Packets: Sent = 2,Received = 0, Lost = 1(100% loss)

隱藏文字回顯

只需在命令後面新增 >nul 即可將其重定向為 null。

ping -n w 1000 1.1.1.1 >nul

這不會輸出任何東西。