How to set delay in vbscript

前端 未结 11 1419
鱼传尺愫
鱼传尺愫 2020-12-03 09:35

How to set delay in vbscript?

WScript.Sleep(100) does not work on Windows XP, Vista.

11条回答
  •  青春惊慌失措
    2020-12-03 10:09

    Here is my solution. Worked with script, which was ran by third party program with no WScript declared and no import allowed.

    Function MySleep(milliseconds)
      set WScriptShell = CreateObject("WScript.Shell")
      WScriptShell.Run "Sleep -m " & milliseconds, 0, true
    end Function
    

    Update
    Looks like Microsoft removed Sleep.exe from win 8, so this doesn't work in win 8 unless you put Sleep.exe in folder defined in %path%.

提交回复
热议问题