0

I have created a batch file that changes the proxy settings based on the wireless SSID connection. I have set it to the Task scheduler, so that whenever I am logged in at the office, the proxy settings will kick in. Here is my batch file.

Set SSID=%VAR1% %VAR2%
echo -------------------------------------
Echo Current Wireless Network: "%SSID%"
echo -------------------------------------
echo .

If "%SSID%" == "NameOfSSID" (
    ECHO ------------
    echo Enable Proxy
    ECHO ------------
    SETX /M HTTP_PROXY "proxy.company.com:80"
    SETX /M HTTPS_PROXY "proxy.company.com:80"
    SETX /M NO_PROXY "127.0.0.1,localhost"
) ELSE (
    SETX /M HTTP_PROXY ""
    SETX /M HTTPS_PROXY ""
    SETX /M NO_PROXY "127.0.0.1,localhost"
)

The batch file kicks in when I login and runs. But when I try to browse, I have to manually enable it in the Internet connection settings as shown below. (shortcut to this settings is proxycfg in windows start).

Internet Connection Settings

I understand that there are many questions (and answers) on SuperUser. I just can't find the solution for this issue. Please help.

DigitalNomad
  • 1,918

0 Answers0