How do I change the Windows7 LAN proxy config from the command line?

Solution 1:

In Windows 7 proxycfg.exe has been replaced with the netsh command. Netsh.exe is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running. To setup a local machine proxy you would use the following syntax:

  • open a command prompt in administrative mode (hit start globe, type cmd, then hit Ctrl+Shift + Enter)

To set a proxy:

netsh winhttp set proxy [proxy server address:port number] [bypass list]

Example:

netsh winhttp set proxy "myproxy.proxyaddress.com:8484" "<local>;*.proxyaddress.com"

To check your proxy server setting:

netsh winhttp show proxy

To remove the proxy server setting:

netsh winhttp reset proxy

The netsh command is interactive so you can always just type netsh and then the subsequent commands you need to save some key stroaks.

Important note: If you're running on a 64-bit OS, and want the proxy to be applied for 32-bit processes as well, you'll need to also modify your settings by running C:\Windows\SysWow64\netsh.exe. This is caused by a bug in Windows 7's version of netsh.exe, which doesn't write the registry values to the Wow6432Node key. This bug seems to be fixed for Windows 10 (and probably Windows 8 as well)

Solution 2:

I do not know how to change proxy in windows 7 from command line.

But there is a tool to switch Windows proxies easily. We can configure several proxies and switch between proxies from the system tray. I know this is not the answer you are looking for but will probably help other users.

Check here:

http://www.winhelponline.com/blog/quickly-switch-proxy-settings-using-ieproxy/

http://ieproxy.codeplex.com/releases/view/19014

EDIT:

Btw, these are the registry settings for Windows proxy, should be easy to write a script to change the ie proxy from command line. I haven't tried it though.

http://ozansafi.wordpress.com/2009/07/05/enabledisable-change-ie-proxy-by-scriptprogrammatically/