I'm trying to create a script that allows the user to choose which proxy settings want to use among several possible. The changes are applied correctly but takes about 20 or 30 seconds to appear at the proxy settings of Internet Explorer. My scripts are called from a .bat process running as administrator. Any idea?
-
Hello and welcome to serverfault. Please take the time to read your question again and ask yourself if someone knowing nothing about your situation has all the element to start troubleshooting. Thereafter, please adds the (numerous) missing details and you might get an answer.– StephaneSep 20, 2013 at 9:13
Add a comment
|
1 Answer
Sorry, @Stephane you're right. First I'll start by scripts that I am using:
Proxy.bat
@echo off rem Programa: cambioProxy.bat set ruta=%0 cd %ruta:~0,-16% :Menu cls echo CAMBIO DE SCRIPTS echo ------------------------- echo. echo A. Proxy proxy1 echo B. Proxy proxy2 echo S. Salir echo. choice /C abs /n /T 15 /D S /M "Seleccione Proxy " if errorlevel 3 goto Salir if errorlevel 2 goto proxy2 if errorlevel 1 goto proxy1 if errorlevel 0 goto Menu :proxy1 takeown /F %ruta:~0,-16%\proxy1.vbs proxy1.vbs echo Cambio de Proxy Realizado a proxy1 goto Menu :proxy2 takeown /F %ruta:~0,-16%\proxy2.vbs proxy2.vbs echo Cambio de Proxy Realizado a proxy2 goto Menu :Salir echo.
These are the scripts. Are identical, except for the server and port, then I'll change exceptions
Proxy1.vbs
dim strProxyServer ' define el proxy y el puerto si es necesario strProxyServer = "proxy1:8080" ' ubicacion en la registry dim strRegPath strRegPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" Set oWshShell = CreateObject("WScript.Shell") ' modifica las entradas en el registro Call oWshShell.RegWrite(strRegPath & "ProxyEnable", "00000001", "REG_DWORD") Call oWshShell.RegWrite(strRegPath & "ProxyOverride", "localhost;webmail.*;", "REG_SZ") Call oWshShell.RegWrite(strRegPath & "ProxyServer", strProxyServer, "REG_SZ") Call oWshShell.RegWrite(strRegPath & "AutoConfigURL", "", "REG_SZ") ' notificacion Msgbox "Proxy setting enabled. " & VbCrLf & "Server - " & strProxyServer ' destroy Set oWshShell = Nothing
Proxy2.vbs
dim strProxyServer ' define el proxy y el puerto si es necesario strProxyServer = "proxy2:80" ' ubicacion en la registry dim strRegPath strRegPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" Set oWshShell = CreateObject("WScript.Shell") ' modifica las entradas en el registro Call oWshShell.RegWrite(strRegPath & "ProxyEnable", "00000001", "REG_DWORD") Call oWshShell.RegWrite(strRegPath & "ProxyOverride", "localhost;", "REG_SZ") Call oWshShell.RegWrite(strRegPath & "ProxyServer", strProxyServer, "REG_SZ") Call oWshShell.RegWrite(strRegPath & "AutoConfigURL", "", "REG_SZ") ' notificacion Msgbox "Proxy setting enabled. " & VbCrLf & "Server - " & strProxyServer ' destroy Set oWshShell = Nothing
My SO is Windows 7 Professional.Don't know if there's anything else I can add