Quantcast
Channel: IT民工的坐井观天 » ie
Viewing all articles
Browse latest Browse all 4

使用批处理脚本BAT在windows下自动切换代理

0
0

我想很多同学都和我有一样的问题,使用公司配发的笔记本,公司里有一套代理设置,家里没有代理或者也有一套代理设置。每次开机都得重新设置,很麻烦,索性写个脚本来处理这些杂事。Windows下Shell虽然不如linux下那么强大(我觉得公司这个XP系统已经严重阻碍了我的工作效率),但是批处理BAT脚本处理这些事情还是绰绰有余的。

@echo 去除Maven代理设置
copy "C:\Documents and Settings\908477\.m2\home\settings.xml" "C:\Documents and Settings\908477\.m2\settings.xml"
@echo 去除IE代理设置
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
pause

也可以设置具体的proxy地址,端口

@echo 开始设置IE代理上网
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "192.168.4.64:4444" /f

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles



Latest Images