CSDN博客

img chance_wang

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

发表于2010/4/27 10:51:00  30267人阅读

分类: 软件工具

由于没有原生的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.
0 0

相关博文

我的热门文章

img
取 消
img