tags:

views:

73

answers:

2

I'm not sure how to describe this without an image, so attached is a quick snip from what I want to do in a batch file (Windows 7 Enterprise 32 bit)

LAN Proxy

In Internet Options, under the Connections tab, there's a LAN settings button (marked in red), that opens the displayed dialog from the image. I already have the address and port I want, all I want is a way to check or uncheck the marked checkbox from a batch file. I would also accept an answer for how to do it in C#.

EDIT:

For other people who stumble across this question, this question is just for me being a power user. If you have a product that needs to change Proxy server settings, don't assume the settings are correct, use PostMan's second registry entry to properly set the proxy first.

+1  A: 

You could use Powershell for playing with proxy settings from a batch file or command line, one example in this blog entry http://devpinoy.org/blogs/velocity/archive/2007/06/23/setting-proxy-settings-in-ie-using-powershell.aspx

Edgar Sánchez
+2  A: 

Yes you can do this using the command reg.

it's stored in HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\

so you can use the following command in a batch file:

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\\" /v "ProxyEnable" /T REG_DWORD /d 1

This will set the ProxyEnable to 1 (Enabled)

and

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\\" /v "ProxyServer" /T REG_SZ /d "192.168.1.1:8080

To set the proxy to 192.169.1.1:8080

Take note of the extra slash at the end of Internet Settings, without it the slash cancels the "

Also, You can add /f to force the over writing of the old value, currently it wil lask to confirm overriding.

PostMan