笔记4
已有 527 次阅读2013-2-4 15:03
|个人分类:笔记
Option Explicit
Dim objShell, strKey, strProxyEnable, strProxyServer, strBypass, strBypassOld, strArr, strTmp, strRet
Dim strProxyIP, strBypassIP
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Change your needed IP here
strBypassIP = "10.190.34.179" 'Please use ';' to separate the bypass exception IPs
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
strKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\"
strBypass = "ProxyOverride"
On Error Resume Next
' Create the Shell object
Set objShell = CreateObject("WScript.Shell")
' Set the bypass exception IP
' First get the old bypass list
strBypassOld = objShell.RegRead(strKey & strBypass)
strArr = Split(strBypassIP, ";", -1, 1)
For Each strTmp In strArr
strRet = InStr(strBypassOld, strTmp)
If strRet = 0 Then strBypassOld = strBypassOld & ";" & strTmp
Next
If Left(strBypassOld, 1) = ";" Then strBypassOld = Mid(strBypassOld, 2)
' Set the bypass exception IP
objShell.RegWrite strKey & strBypass, strBypassOld, "REG_SZ"
WScript.Quit