① vbs瀹氭椂鍏虫満
vbs浠g爜濡備笅:绋嬪簭宸茬粡閫氳繃娴嬭瘯~(鑷鍔ㄨ捐嚜韬涓哄惎鍔ㄩ」)
set ws=createobject("wscript.shell")
ws.Regwrite"HKLM\Software\Microsoft\Windows\CurrentVersion\Run\",wscript.scriptfullname
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
if a<8 then
wscript.sleep 1000*60*10
call shut_down()
end if
case else
if a<8 then
wscript.sleep 1000*60*10
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(2)
Next
end sub
② 求vbs倒计时自动关机代码。。
setws=wscript.createobject("wscript.shell")
i=inputbox("输入定时关机时间,单位为分钟","时间设置")
s="shutdown-s-t"&i*60
ws.runs,0