Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have to connect to my university proxy if I have to access the internet and my university has two proxies.

Now at times on of em gets inundated with traffic so we switch to the other proxy, now I was wondering if I could write a batch script or a python file and assign it a keyboard shortcut so the switch would be fast!

share|improve this question
    
Why is this tagged both "windows-7" and "ms-dos"? Windows 7 doesn't use MS DOS. –  Ignacio Vazquez-Abrams Jan 30 '14 at 12:49
    
@IgnacioVazquez-Abrams I think it is clear that he meant command line / batch script rather than actual ms-dos. But the question should indeed be corrected, as it now has been :) –  zelanix Jan 30 '14 at 12:53
    
@zelanix: If someone doesn't call them out on it then they'll never learn. –  Ignacio Vazquez-Abrams Jan 30 '14 at 13:11

3 Answers 3

up vote 1 down vote accepted

You should be able to set the proxy with netsh:

netsh winhttp set proxy myproxy
netsh winhttp set proxy myproxy:80 "<local>;bar"
netsh winhttp set proxy proxy-server="http=myproxy;https=sproxy:88" bypass-list="*.foo.com"

Those are the examples from netsh winhttp set proxy help. The WinHTTP proxy settings aren't used by all applications. It's probably best to use the solution outlined in zelanix answer and then just import the IE settings into WinHTTP with:

netsh winhttp import proxy source=ie
share|improve this answer
    
Proxy configuration in Windows is a nightmare! Probably winhttp is the way to go, though. –  zelanix Jan 30 '14 at 13:06

Proxy configuration is tricky becuse it is often configured in each application separately. However, many application use the Internet Explorer settings as the default and they can be set through the registry as detailed here (Microsoft Support). You could create a .reg file for each proxy and either double click it to apply the settings or create a simple batch script to import it.

The registry file has the following form:

Regedit4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"MigrateProxy"=dword:00000001
"ProxyEnable"=dword:00000001
"ProxyHttp1.1"=dword:00000000
"ProxyServer"="http://ProxyServername:80"
"ProxyOverride"="<local>"

Alternatively configure each proxy in turn and then browse to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings and export the relevant settings.

This configuration could of course also be wrapped up in anything else (VBScript or whatever) that is capable of writing to the registry.

share|improve this answer

The system proxy server can be modified using the netsh command in Windows 7.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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