Option Explicit
On Error Resume Next
Dim sProgramme, sRunTime, aTime, iHour, iMinute, oShell
sProgramme = "C:\Test.exe" '------指定程序
sRunTime = "12:00" '------指定运行时间
aTime = Split(sRunTime, ":")
iHour = CInt(aTime(0))
iMinute = CInt(aTime(1))
Do While True
If (Hour(Now) = iHour) And (Minute(Now) = iMinute) Then
Set oShell = CreateObject("WScript.Shell")
oShell.Run sProgramme, 1, False
Set oShell = Nothing
Exit Do
End If
WSH.Sleep 1000
Loop
比如说你想在5秒后打开任务管理器
Dim objws
Set objws=WScript.CreateObject("wscript.shell")
wscript.sleep 5000
objws.RUN "taskmgr.exe"