win7 快速切换ip

 

新建bat文件 注意 必须切换到ansi编码

  • 切换到静态ip
netsh interface ipv4 set address name="本地连接" source=static addr=192.168.10.199 mask=255.255.255.0 gateway=192.168.10.1 gwmetric=0 >nul
netsh interface ipv4 set dns name="本地连接" source=static addr=1.2.4.8 register=PRIMARY >nul
netsh interface ipv4 add dns name="本地连接" addr=223.5.5.5 index=2 >nul
  • 切换为动态
netsh interface ip set address  "本地连接"  dhcp
netsh interface ip set dns  "本地连接" dhcp
  • 增加ie代理
@echo off
title 自动设置代理服务器 没有代理
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 "127.0.0.1:1080" /f
echo 设置完毕
  • 取消ie代理
@echo off
title 自动设置代理服务器 没有代理
echo 正在清空代理服务器设置……
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f
echo 代理服务器设置已经清空
echo 设置完毕