SetProxy: 一个设置IE代理的命令行小工具

IE的代理设置用起来并不方便,我自己而言就要经常更改代理服务器,相信很多人有跟我相同的需要。使用C++编写了一个小程序SetProxy调用Win32 API来设置代理服务器IP,用起来方便多了。


SetProxy IP:port


SetProxy ""



源代码也放在这里,希望有需要的人可以用得上 ;)


这是一份有些年头的代码, 如果你在较新的编译器下编译这个项目, 请先做[[setproxy-一个设置ie代理的小工具#comment-995|这里所述的小修改]]. — Eric on Apr. 9, 2014.

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.


    1. Sorry, no Chinese input method installed…

      Try to make this change to the SetProxy.cpp:

      #include <iostream.h>


      #include <iostream>
      using namespace std;

      The new compiler from MS Visual Studio seems have obsoleted the “<iostream.h>” like headers.

      BTW: this is a plain old piece of code which is written on Windows XP. I am surprised that someone like you tried it. I am surprised again that this piece of code is still working on Windows 7 after I tried it. Good backwards compatibility, MS!

      BTW: Sorry, but who are you? Collage classmate? You are using Visual studio and have interests on command line tools on Windows. There are not many people like this around there except CS students/graduates.

      1. 你说的这俩地方我在看到代码时候就已经改了,可是还是编不过去啊….我Li Yiji…..这两天Evernote同步总是失败,这东西不能自己设代理,又觉得手动改ie代理太麻烦,所以上网搜了一下,然后就搜到你这里了

      2. 咦,你是不是更新了源码的下载链接…我记得以前下载的只有个SetProxy.cpp啊…..这回刚下载的能编译过去了…..

              1. 我在系统里找到了WinInet.h这个文件啊….windows是大小写不敏感的吧,我记得

                1. 这个我就不太知道问题可能在那里了. 你diff下看这个有没有些特殊代码在里面. 另外比较一下编译器在这个project里面的参数设置看有没有特殊的地方. 我当初些这个程序时应该是在32位系统下的.

  1. Thank you very much!
    This really helped because setting the proxy by command line using the registry keys requires the user to open the window “LAN settings” and closing to wake up browsers about the change.
    However, your software really overcomes this problem!

Leave a Reply

Your email address will not be published. Required fields are marked *