MCSE技术论坛

首页 » 开发者俱乐部 » windows脚本 » 关机脚本
洛洛 - 2007-6-21 15:48:00
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


中国水域 - 2007-6-21 17:14:00
问一下,关于脚本能不能在安全模式下,开机自动执行~?
icebee88 - 2007-6-24 14:22:00
收藏起来,很有用的,谢谢呀:D
ladchee - 2007-7-11 17:18:00
给你个更简单的关机脚本 不过是 bat的。

start shutdown -s -f -t 0

马上关机!
1
查看完整版本: 关机脚本