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.

NotepadPlusPlus PRO
  • 1,489
  • 6
  • 19
  • 35
  • Try https://support.microsoft.com/en-us/kb/819961. – Kinnectus Jul 07 '16 at 14:06
  • So, when you say you have to manually enable it, do you have to type in the proxy address and port or just check that box that says "Use a proxy server for your LAN..." Or both? – Narzard Jul 07 '16 at 14:16
  • @Narzard The setting dialog box remembers the settings, I just have to check that box. – NotepadPlusPlus PRO Jul 07 '16 at 14:18
  • @BigChris I am looking for automated way to switch proxy based on wireless SSID. – NotepadPlusPlus PRO Jul 07 '16 at 14:18
  • The link will help write the script – Kinnectus Jul 07 '16 at 14:20
  • @BigChris can you please help? I already tried one and it did not work. – NotepadPlusPlus PRO Jul 07 '16 at 14:24
  • I'm not sure where you got your information from, but simply creating variables named "HTTP_PROXY" and such via SETX are not going to have any affect on your IE proxy settings... The only reason your proxy address is showing in IE at all is because you've set it properly at some point in the past, and it remembers the entry until you change it. You need to modify the Registry settings pointed out in the article Big Chris linked. – Ƭᴇcʜιᴇ007 Jul 07 '16 at 14:59

0 Answers0