求一定时关机的vbs脚本代码,实现剩余时间动态显示

2024-11-03 17:32:52
推荐回答(1个)
回答1:

'关机代码
dim ntime
ntime = inputbox ("关机时间min",,30)
msgbox ntime & " min"
ntime=ntime*60
set a = CreateObject("wscript.Shell")
a.Run "Shutdown /f /s /t " & ntime & " /c " & "关机定时" & ntime/60 & "min",0

'取消关机代码
set a = CreateObject("wscript.Shell")
a.Run "Shutdown /a",0 '取消关机