关机VBS脚本
1.關機腳本(shutdown1.vbs):
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
??? ObjOperatingSystem.Win32Shutdown(8)
Next
2.延時60秒,在關機前提示,可以在延時到達前取消關機(shutdown2.vbs腳本):
set wshshell = CreateObject("WScript.Shell")
timeout = 60
'Time Out 可以自己定義
ask = "系統將在 " & timeout & " 秒鐘后關機!"
title = "自動關機提示"
constants = vbExclamation + vbOkCancel
result = wshshell.Popup(ask, timeout, title, constants)
if result = vbCancel then
elseif result = true then
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(8)
Next
end if
轉載于:https://my.oschina.net/XTechFly/blog/639652
總結
- 上一篇: T510拆机有感
- 下一篇: 猎豹网c 语言程序设计,[C/C++基础