求助:VBS关闭当前多个指定标题的IE窗口

Dim a,bSet a=WScript.CreateObject("WScript.shell")b=1Doif b=4 then exit dowscript.sleep 1000 If a.AppActivate("HTTP 403 禁止访问") = True Then a.SendKeys "%{F4}{F4}{F4}" b=b+1 Else exit do End IfLoopset a=nothing 想同时关闭多个指定标题的IE窗口,例如,窗口标题为“HTTP 403 禁止访问”或“Internet Explorer 无法显示该网页”或“网页维护中”请问上面的代码如何修改?希望大侠帮我完善修正一下好吗?
2026年09月20日 00:54
有1个网友回答
网友(1):

你的那个太不精准了。

注意Title里面的值一定要与你要关闭的IE的标题一致,不支持模糊关闭。

on error resume next
Title="HTTP 403 禁止访问,Internet Explorer 无法显示该网页,网页维护中"
set s=createobject("shell.application")
for each w in s.windows
if instr(1,w.type,"HTML") > 0 then
if instr(1,Title,w.locationname) >0 then w.quit
end if
next