使用VBS更改代理

时间:2015-07-07 14:06:00

标签: vba vbscript

我正在尝试使用vbs点击一下来更改代理。这是我到目前为止所得到的

dim oShell,strDesktop
set oShell = Wscript.CreateObject("Wscript.Shell")

if msgbox("Turn Proxy on?", vbQuestion or vbYesNo) = vbYes then
oShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 1, "REG_DWORD"
oShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer", "192.168.80.45:80", "REG_SZ"
else
oShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 0, "REG_DWORD"
end if
 strDesktop = oShell.SpecialFolders("Desktop") 
 oShell.AppActivate strDesktop
oShell.SendKeys "{F5}"
Set oShell = Nothing

此脚本正在更改Proxy设置中的Configure Proxy Server,但实际更改未生效(我无法浏览任何网站)。当我实际转到Configure Proxy Server并点击ok时,更改即生效。看起来尽管更新代理值,但更改(代理)实际上并未生效。知道如何设置它的工作

0 个答案:

没有答案