在我的情况下,Internet Explorer 被禁用,因此首先终止 iexplore.exe 是不可能的,因为它没有运行,并且每次都重新启动 explorer.exe 是不可取的。但我发现,至少在 Windows 7 代理设置中,当您在 Internet 选项内的“LAN 设置”窗口中单击“确定”时会刷新。
由于我无法使用命令提示符找到任何其他方法来执行此操作,因此我编写了一个简单的 AutoHotkey 脚本,该脚本会自动单击所有必要的按钮。唯一的缺点是这发生在前台,改变了窗口焦点,并且没有办法最小化或隐藏我所知道的。
在运行/命令提示符中输入此内容或添加到 bat 文件以打开 Internet 选项窗口:
control /name Microsoft.InternetOptions
在打开 Internet 选项窗口之前运行此 AHK 脚本,因为脚本会等待窗口出现,并且如果窗口已经存在,则可能无法运行:
; wait for 'Internet Options' window to appear
WinWait, Internet Properties
; delays should account for any interface lag. Increase them if you find them insufficient for your particular case
Sleep 100
; focus on 'Internet Options' window, just in case focus is stolen by other window
WinWaitActive, Internet Properties
Sleep, 50
; hold Ctrl and press Tab 4 times to switch to 'Connections' tab
Send {Ctrl down}{tab 4}{Ctrl up}
Sleep, 250
; press Alt+l (keyboard shortcut for 'LAN Settings'). Change this if your system/user locale differs from English
send !l
Sleep, 500
; pressing enter here clicks OK in 'LAN settings' window, closing it. Using 'ControlClick OK' here results in AHK pressing OK button of the parent window instead to no effect
send {enter}
Sleep, 250
; click OK
ControlClick OK
return