Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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="*"

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
What does that 88 means in https=sproxy:88"? And what is the correct format for myproxy and sproxy? Should I replace myproxy with and sproxy with for example? – Abraham Oct 7 '15 at 7:22
@Abraham: 88 is the port on which the proxy for HTTPS connections can be reached. Your examples look correct to me. I also added a link to the official netsh documentation for this command to my answer. Hope it helps :) – Oliver Salzburg Oct 7 '15 at 7:28

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:


[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .