自己写的一个定时关机或重启的vbs脚本
-
dim ActionID
-
ActionID = 1 '0注销,1关机,2重启,
-
ActionTime = "2006-1-4 13:42:30" '关机或重启时间
-
-
function ShutDown()
-
dim objShell
-
Set objShell = WScript.CreateObject("Wscript.Shell")
-
-
dim Application
-
set Application = CreateObject("Shell.Application.1")
-
Application.ShutdownWindows()
-
dim upi
-
for upi = 0 to 4
-
WScript.Sleep(50)
-
objShell.sendKeys("{UP}")
-
next
-
For upi = 1 to ActionID
-
WScript.Sleep(50)
-
objShell.sendKeys("{DOWN}")
-
next
-
'使用时,请把下行的注释符去掉
-
'objShell.sendKeys("{ENTER}")
-
end function
-
-
While true
-
if DateDiff("s", Now, ActionTime) < 0 then
-
ShutDown()
-
end if
-
WScript.Sleep(5*1000)
-
wend
-
-
-
'将上面代码存为vbs文件,如:shutdown.vbs,然后双击或在文件上点右键选择以命令提示打开,
-
'如果到了你设置重启的时候,系统会出现关机的对话框。
-
'直接下面代码程序会出现关机的对话框,最后的回车注释掉了,正常使用时,请去掉注释符。
相关文章
热门资讯