欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

VBS 断网后自动关机30秒后

程序员文章站 2022-04-29 09:20:50
复制代码 代码如下: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