VBS 断网后自动关机30秒后
程序员文章站
2022-08-27 14:30:35
复制代码 代码如下:dim wsh,objwmiservice,colmonitoredevents set wsh = wscript.createobject("wsc...
复制代码 代码如下:
dim wsh,objwmiservice,colmonitoredevents
set wsh = wscript.createobject("wscript.shell")
set objwmiservice = getobject("winmgmts:\. ootwmi")
set colmonitoredevents = objwmiservice.execnotificationquery("select * from msndis_statusmediadisconnect")
do while true
set strlatestevent = colmonitoredevents.nextevent
wsh.run "shutdown -s -t 30 -c "&chr(34)&"系统网络断开,机器即将关闭"&chr(34)
loop