Fast way to switch off proxy in Windows

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

Solution 1:

Use the following batch file:

@echo off
netsh winhttp reset proxy

Notes:

  • The WinHTTP proxy settings aren't used by all applications.
  • See answer How can I change the system proxy from the command line? by Oliver Salzburg for more information.
  • If the above solution doesn't work for your particular application Solution 2.

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

  • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
  • netsh - Configure Network Interfaces, Windows Firewall, Routing & remote access.

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.

Examples:

SETPROXY myproxyserver:8888
SETPROXY none