Auto Enable or Disable IE Proxy

It is painful to turn on/off the IE proxy manually in office/home. I wrote up a simple batch script to detect the location and automatically enable/disable the proxy when I login.

@echo off
REM Auto enable/disable IE proxy settings

REM Define your proxy server here
set proxy-server=my-proxy-server

REM Enter the script path
cd D:\scripts\batch

REM Create Reg file
echo Windows Registry Editor Version 5.00 > proxy-setting.reg
echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] >> proxy-setting.reg

REM Test the network to Proxy
ping -n 2 %proxy-server%
if %errorlevel% == 0  (
echo “ProxyEnable”=dword:00000001  >> proxy-setting.reg
) else (
echo “ProxyEnable”=dword:00000000 >> proxy-setting.reg)

REM Import the reg file
reg import proxy-setting.reg


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s