批量睡眠/等待命令
我想在我的批处理文件中添加时间延迟。批处理文件将在后台静默运行。请帮我。
I want to add time delay in my batch file. The batch file will be running silently at backgorund. Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
timeout 5
延迟
timeout 5 >nul
延迟而不要求您按任何键取消
timeout 5
to delay
timeout 5 >nul
to delay without asking you to press any key to cancel
例子
example
你想使用超时。
会睡10秒
You want to use timeout.
will sleep 10 seconds
好的,是的,您使用
timeout
命令来睡眠。但是要安静地完成整个过程,使用 cmd/batch 是不可能的。其中一种方法是创建一个VBScript,它将运行批处理文件而无需打开/显示任何窗口。这是脚本:
将上面的代码复制并粘贴到记事本上并将其另存为
任意名称.**vbs
**
*“带有引号的批处理文件的路径”* 的示例可能是:
“C:\ExampleFolder\MyBatchFile.bat”
Ok, yup you use the
timeout
command to sleep. But to do the whole process silently, it's not possible with cmd/batch. One of the ways is to create a VBScript that will run the Batch File without opening/showing any window.And here is the script:
Copy and paste the above code on notepad and save it as
Anyname.**vbs
**
An example of the *"PATH OF BATCH FILE WITH QUOTATION MARKS" * might be:
"C:\ExampleFolder\MyBatchFile.bat"