定时关机.vbs
来自「定时关机工具 输入多少时间后关机(单位:秒)」· VBS 代码 · 共 24 行
VBS
24 行
'****************************************
'*by r05e
'*关机
'****************************************
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
Function shut()
setTime=InputBox("请输入多少时间后关机(单位:秒)"," 定时关机", "", 100, 100)
If setTime<>"" Then
IF IsNumeric(setTime) Then
timeS=setTime*1000
wscript.sleep timeS
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(1)
Next
Else wscript.echo "输入错误,请重试"
shut()
End If
Else wscript.echo "操作取消"
End If
End function
shut()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?