其实你的意思就是满足两个条件之一就关机:超过23:00:00或者超过3个小时- Set WshShell = CreateObject("Wscript.Shell")
- SleepTime = "23:00:00"
- for i = 1 to 3
- counter = 0
- While counter<60
- if DateDiff("s", Time, SleepTime) < 0 then
- WshShell.Popup "睡眠时间已到,马上就会关机! ", 20, "温馨提示", vbInformation
- WshShell.run "shutdown -s -r -t 0"
- Wscript.Quit
- end if
- WScript.Sleep 1000*60
- counter = counter + 1
- wend
- WshShell.Popup "你已经使用电脑" &i& "个小时了,请注意休息! ", 10, "温馨提示", vbInformation
- next
- Wscript.Sleep 1000*15
- WshShell.Popup "电脑的使用时间已到,马上就会关机! ", 20, "温馨提示", vbInformation
- WshShell.run "shutdown -s -r -t 0"
复制代码
|