dim closeTime
closeTime = inputBox("请输入自动关机的时间(格式 HH:MM):") ' 自动关机时间
if closeTime = "" then
msgBox("设置错误,程序退出")
else
msgBox("已设置自动关机!")
dim countDownTime : countDownTime = 30 ' 允许取消关机倒计时时间
dim oShell : set oShell = WScript.CreateObject ("WSCript.shell")
do while true
dim nowTime : nowTime = cstr(formatDateTime(time(), 4))
if nowTime = closeTime then
oShell.run "Shutdown /s /t " & countDownTime & " /c 开始自动关机了,请注意将资料存盘 /d p:1:1"
if msgBox("确定关机吗?", vbyesno) = vbno then
oShell.run "Shutdown /a"
end if
Set oShell = Nothing
exit do
WScript.Quit 1
end if
WScript.sleep 3000
loop
end if