如何在Windows的命令提示符睡5秒? (或DOS) [英] How to sleep for 5 seconds in Windows's Command Prompt? (or DOS)

查看:165
本文介绍了如何在Windows的命令提示符睡5秒? (或DOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

窗口的截图工具可以捕获屏幕,但有时我想捕捉画面5秒钟后,如拍摄图像被摄像头显示。 (运行脚本和微笑镜头,例如)。

Windows's Snipping tool can capture the screen, but sometimes I want to capture the screen after 5 seconds, such as taking an image being displayed by the webcam. (run the script and smile at the camera, for example).

因此​​在Ruby中,我可以做类似

So in Ruby, I could do something like

sleep 3
system('c:/windows/system32/SnippingTool.exe')

但不是所有的计算机有红宝石,让我怎么做,在一个.bat文件? (东西是可运行大部分PC上的截图工具)。

but not all computer has Ruby, so how do I do that in a .bat file? (something that is runnable on most PC with Snipping tool).

的问题是,有一个bat文件没有睡眠可用

The problem is that there is no "sleep" usable in a .bat file.

推荐答案

一劈我所看到的是(MIS)使用ping命令:

One hack I have seen is to (mis)use the ping command:

ping 127.0.0.1 -n 6 > nul

127.0.0.1是本地主机的IP地址。结果
-n 6有每一个ping之间的延迟1秒,因此对于一个5秒延迟,你需要做的6坪。结果
NUL狼吞虎咽的输出。

127.0.0.1 is the localhost IP address.
-n 6 There is a 1s delay between each ping, so for a 5s delay you need to do 6 pings.
nul gobble the output.

这篇关于如何在Windows的命令提示符睡5秒? (或DOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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