Board logo

标题: [问题求助] vbs循环内容请教 [打印本页]

作者: netdzb    时间: 2021-9-6 08:43     标题: vbs循环内容请教

下面这段代码是死循环

do
循环内容
loop

我想让代码循环10分就结束应该怎么写啊?
作者: zz100001    时间: 2021-9-9 02:03

设置一个全局时间,来计时,到了时间就跳出,循环里面写 exit do
如果用while写就方便点
  1. ' 等待秒数
  2. ddsj = 10 * 60
  3. WScript.Echo "开始计时"
  4. kssj = Now
  5. diff = 0
  6. While diff < ddsj
  7. WScript.Echo diff
  8. Wscript.Sleep 1000
  9. diff = (Now - kssj) * 24 * 60 * 60
  10. WEnd
  11. WScript.Echo "时间已到"
复制代码





欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2