For IPS_I = 0 To UBound(IPS) If IPS_I > GetI Then IPTemp = Split(IPS(IPS_I), ":") ChangeProxy IPTemp(0), IPTemp(1) Set WshShell = CreateObject("wscript.shell") WshShell.run("cscript " & WScript.ScriptFullName & " " & IPS_I) wscript.quit End If Next
Sub YourCode() '你的代码 End Sub
'使用WMI切换IE代理(Use WMI Change IE Proxy)
Function ChangeProxy(IP, Port) '获取计算机名 'Set oNetwork = WScript.CreateObject("WScript.Network") 'computername=oNetwork.ComputerName On Error Resume Next Set objWMIService = GetObject("winmgmts://./root/CIMV2") Set objShare = objWMIService.Get("Win32_Proxy.ServerName='computername'") Set objInParam = objShare.Methods_("SetProxySetting").inParameters.SpawnInstance_() objInParam.Properties_.Item("ProxyPortNumber") = Port objInParam.Properties_.Item("ProxyServer") = IP Set objOutParams = objWMIService.ExecMethod("Win32_Proxy.ServerName='computername'", "SetProxySetting", objInParam) End Function