在批处理中延时(等待)

echo CreateObject("scripting.filesystemobject").deletefile(WScript.scriptfullname):WScript.sleep WScript.Arguments(0)>%Temp%\SleepScript.vbs
start /wait %Temp%\SleepScript.vbs <DelayTime>
  • 其中 <DelayTime> 为要延时的毫秒数。

  • 众所周知,在旧版本 Windows 中,批处理并不原生支持延时。新版本 Windows 中的 timeout 延时不够精细。

Change Log

20180713

  • 精简代码。

20180401

  • 首个版本。