由于没有原生的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 10000part specifies the desired timeout in milliseconds. - The
-n 1part tells ping that it should only tries once (normally it'd try 4 times). - The
> nulpart is appended so the ping command doesn't output anything to screen.
本文介绍了一种在Batch脚本中实现等待特定时间的方法。通过使用ping命令并指定不存在的目标地址及所需的超时时间来间接达到暂停的效果。此方法适用于Windows批处理文件,能够帮助开发者在脚本中轻松加入延迟。
固定时间&spm=1001.2101.3001.5002&articleId=5533040&d=1&t=3&u=efe5a54db0064708985b263a54d5b8e3)
405

被折叠的 条评论
为什么被折叠?



