BAT脚本:等待(sleep/wait)固定时间

由于没有原生的sleep或者wait命令,需要想其他办法在batch脚本里实现这个功能。

来源:http://stackoverflow.com/questions/735285/how-to-wait-in-a-batch-script

You can ping a random address and specify the desired timeout:

ping 123.45 . 67.89 - n 1 - w 10000 > nul

And since the address does not exists, it'll wait 10,000 ms (10 seconds) and returns.

  • The -w 10000 part specifies the desired timeout in milliseconds.
  • The -n 1 part tells ping that it should only tries once (normally it'd try 4 times).
  • The > nul part is appended so the ping command doesn't output anything to screen.

你可能感兴趣的:(脚本,command,Random,output)