Whenever I connect to a corporate VPN it always sets a proxy server. It is necessary for corporate WiFi but this proxy is inaccessible from internet.

This means that whenever I connect from home WiFi I cannot open any page except internal network.

The solution is to click on Start, Control Panel, Network and Internet, Internet options, Connection, Local network setting and switch off proxy checkbox there. This procedure is annoying.

I would like to have some bat script that turns it off. Could you help me?


5 Answers 5


How do I switch off the proxy from a batch file?

Solution 1:

Use the following batch file:

@echo off
netsh winhttp reset proxy


Solution 2:

  1. Configure the proxy manually using the GUI, then export the registry entries for a disabled proxy [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings].

    See answer How can I change the system proxy from the command line? by zelanix for more information about this step.

    See also How to configure client proxy server settings by using a registry file by Microsoft.

  2. Write a batch file for subsequent use which:

    • Imports the registry file created as above.
    • Uses the netsh winhttp import proxy source=ie command.
  3. Use this batch file in future to disable your proxy.

Further Reading

  • You're welcome. Please feel free to accept my answer. ;)
    – DavidPostill
    Oct 16, 2015 at 15:49
  • Hmm, I found nothing. The script has no effect. Dump says: pushd winhttp reset proxy popd. Show proxy always says that I have direct access without proxy, even when proxy is set and turned on. Any idea? Oct 16, 2015 at 16:09
  • @LeosLiterak Answer expanded to outline a second solution.
    – DavidPostill
    Oct 16, 2015 at 16:31
  • 1
    It seems that only this registry item changes: "ProxyEnable"=dword:00000001 Oct 17, 2015 at 13:48
  • @LeosLiterak That makes it a little easier then ;)
    – DavidPostill
    Oct 17, 2015 at 13:56

I use the SETPROXY tool from the command line, or in combination with SlickRun, where I assigned some magic words using it. The author of both is the well respected original developer of Fiddler Eric Lawrence.


SETPROXY myproxyserver:8888

Here's a refinement of some of answers already here that I plan on using for myself. It doesn't require any additional software, so I figured others might find it helpful.

  1. Use the Windows GUI to configure your proxy settings manually as you see fit.

  2. Create the following two registry scripts:


    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings]


    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings]
  3. Simply run either of the following commands in the same directory as those files to enable/disable:

    regedit /S proxy-on.reg
    regedit /S proxy-off.reg

And it should toggle your system proxy settings and start working immediately. You can then expand on this further either by writing more scripts or by toggling that registry entry on/off directly from someother app (e.g. by using AutoHotkey) with a simple keyboard shortcut.

Personally, I plan on bundling this with a script that establishes an SSH proxy in combination with updating the system proxy settings (and then another script to terminate that connection as well as disabling the proxy system settings).


Need to force system settings update, iexplore do it for you, the batch:

REM Enable-Disable System Proxy in one file
@echo off
SET home_key="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
FOR /F "tokens=3" %%L IN ('reg query %home_key% /v ProxyEnable' ) DO SET currentProxy=%%L
IF %currentProxy% == 0x1 goto turnoff
IF %currentProxy% == 0x0 goto turnon

reg add %home_key% /v ProxyEnable /t REG_DWORD /d 0 /f
SET proxy="Proxy disabled"
goto EOF

reg add %home_key% /v ProxyEnable /t REG_DWORD /d 1 /f
SET proxy="Proxy enabled"
goto EOF

REM Restart Internet Explorer to changes take efect
start /w /b iexplore.exe
timeout 2 /nobreak
taskkill /f /im iexplore.exe
echo %proxy%

For us I exported the AutoConfigURL key located at:

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings

Then use your favorite script flavor or manually delete the key to turn it off and then add the exported key to enable it again. Basically in Internet Properties doing this process unchecks the Use automatic configuration script checkbox when the key is missing and re-checks it when you add the key back.

To do this remotely or for another user, you need to know the user's SID which you can find in AD or look here: %NetworkComputerName%\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

Then you can update your script or navigate manually here: %NetworkComputerName%\HKEY_USERS\%UserSID%\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings

We have a policy to enforce proxy. Users cannot see or change the proxy setting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.