vbs定时关机代码

编程入门 行业动态 更新时间:2024-10-27 04:37:41
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定时关机代码

本文发布于:2023-06-13 22:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1412623.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:定时关机   代码   vbs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!