vbs自动关机

一个自动关机的vbs 留作备份
a=hour(now)
b=weekday(now)

select case b
case 1,3,4,5,6,7
if a>=23 then
call shut_down()
end if
end select

private sub shut_down()
Set colOS = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * FROM Win32_OperatingSystem")
For Each eOs In colOS
eOs.Win32Shutdown(1)
Next
end sub

下面代码可以写启动项

set ws=createobject("wscript.shell")
ws.Regwrite"HKLM\Software\Microsoft\Windows\CurrentVersion\Run\",wscript.scriptfullname

Tags:

Leave a Comment