暂停一个批文件的时间量 [英] Pausing a batch file for amount of time

查看:124
本文介绍了暂停一个批文件的时间量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  

可能显示的文件:结果
  在DOS批处理文件结果睡觉
  
如何在批处理脚本等待


我有一个与批处理文件启动了一个计划。

第一个模块需要10秒左右的初始化,我想办法睡15秒第二个模块之前被调用,但我不希望它要求用户打,如一键暂停似乎要求。

所以,这就是我的意思是:

 回声%PATH%暂停10回声%PATH%

在这个例子中,我希望这是在回声之间10秒。这可能吗?我已经看到了使用平1.1.1.1的一些例子,但它似乎并没有正常工作,所有的时间。


解决方案

 平-n 11 -w 1000 127.0.0.1> NUL

更新

初​​学者的错误。之前或请求之后毫秒,但其间的请求;平不会等待1000群组。因此,要等待10秒钟,你就必须做11坪有10个第二其间的空白。

Possible Duplicates:
Sleeping in a DOS batch file
How to wait in a batch script

I have a program that is kicked off with a batch file.

The first module takes 10 seconds or so to initialize, and I want a way to "sleep" for 15 seconds before the second module is called, but I don't want it to require the user to hit a key like "pause" seems to require.

So, this is what I mean:

echo %PATH%

pause 10

echo %PATH%

In this example, I want there to be 10 seconds in between the echos. Is this possible? I've seen some examples using "ping 1.1.1.1" but it doesn't seem to work all the time correctly.

解决方案

ping -n 11 -w 1000 127.0.0.1 > nul

Update

Beginner's mistake. Ping doesn't wait 1000 ms before or after an request, but inbetween requests. So to wait 10 seconds, you'll have to do 11 pings to have 10 'gaps' of a second inbetween.

这篇关于暂停一个批文件的时间量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆