Dim value
value=inputbox("0:取消关机" & Chr(10) & "1:关机1小时"& Chr(10) & "2:关机2小时"& Chr(10) & "3:关机3小时","轩阁工具箱","",9000,5000)
If value = 1 Then
dim WSHshellA
set WSHshellA=wscript.createobject("wscript.shell")
WSHshellA.run"cmd.exe /c shutdown -a",0,true
WSHshellA.run"cmd.exe /c shutdown -s -t 3600 -f",0,true
Msgbox "计算机将在1小时后关机!"
ElseIf value = 0 Then
dim WSHshellO
set WSHshellO=wscript.createobject("wscript.shell")
WSHshellO.run"cmd.exe /c shutdown -a",0,true
Msgbox "取消关机!"
ElseIf value = 2 Then
dim WSHshellB
set WSHshellB=wscript.createobject("wscript.shell")
WSHshellB.run"cmd.exe /c shutdown -a",0,true
WSHshellB.run"cmd.exe /c shutdown -s -t 7200 -f",0,true
Msgbox "计算机将在2小时后关机!"
ElseIf value = 3 then
dim WSHshellC
set WSHshellC=wscript.createobject("wscript.shell")
WSHshellC.run"cmd.exe /c shutdown -a",0,true
WSHshellC.run"cmd.exe /c shutdown -s -t 10800 -f",0,true
Msgbox "计算机将在3小时后关机!"
ElseIf value ="" then
dim WSHshellD
set WSHshellD=wscript.createobject("wscript.shell")
WSHshellD.run"cmd.exe /c shutdown -a",0,true
Else
dim WSHshellZ
Msgbox "输入错误,请重新输入!"
End if
更多推荐
vbs定时关机代码
发布评论