Originally posted by htysm at 2007-1-21 04:19 PM:
There are so many DOS commands, but there is no delay command, and third-party programs are still required.
I don't agree with this view:
The message sending interval of ping has a time precision of 1 second and is used on the Windows 9x/WinNT series platforms.
Your Windows system needs to have the TCP/IP protocol of the network card normally installed. There are two schemes:
(1) Use the interval time between two message sends of ping. When ping sends multiple messages, after getting the response of the previous message, it will wait for 1 second before sending the next message. The response time varies depending on the model, system, and network configuration. Among them, the IP address 127.0.0.1 is especially crucial because it responds immediately, so it is relatively constant. Most other addresses will have significant differences. This method requires waiting a longer time. The number of messages to send is one more than the waiting time because the first message does not wait. The IP address must be 127.0.0.1. The program to wait for 2 seconds is as follows:
:: According to the planting tree principle, the number after n is one more than the pause seconds
ping -n 3 127.0.0.1>nul
(2) Use the maximum waiting time of ping. ping sends an "Internet Control Message Protocol (ICMP)" echo request message to 0.0.0.1. Because 0.0.0.1 is an IP address that cannot respond to ping requests, by default, ping will wait for a certain maximum response time - it stops waiting after 4 seconds, and -w can change this maximum response time for each message send. And if the IP address is changed to 127.0.0.1 or other IP addresses with very short response times that respond immediately, then -w loses its effect because the waiting time for each send will not reach the maximum response time, and the delay will be shortened at this time. This method requires waiting a longer time. You can directly use -w to specify, but you need to subtract 500 milliseconds (the reason is not known), and the IP address must be an address that does not respond to requests. The program to wait for 2 seconds is as follows:
ping -n 2 -w 500 0.0.0.1>nul
echo Wscript.Sleep Wscript.Arguments(0) * 1000 >c:\delay.vbs
start /w c:\delay.vbs 15 --------------Create a 15-second delay