on error resume next
set hipon=CreateObject("Wscript.Shell")
nnn = 3600
set y=getobject("winmgmts://./root/cimv2")
set x=y.execquery("select * from win32_process where name='wscript.exe'")
if x.count <> 1 then
hipon.run "shutdown.exe -a"
for each i in x
i.terminate()
next
else
msgbox "system off after " & nnn & " s"
hipon.run "shutdown.exe -s -t " & nnn
end if
Wscript.sleep nnn*1000
保存为.vbs文件就可以使用了。
如果要直接关机使用
hipon.run "shutdown.exe -s -t 1"