转自
http://blog.csdn.net/microrain/archive/2007/08/06/1728147.aspx
- @echo off
- color 1f
- title 网络环境切换管理
- echo.
- echo *** 设置IP参数,设置IE代理 ***
- echo.
- echo.
- goto menus~
- :menus~
- echo.
- echo 请选择:
- echo 1 切换到公司网
- echo 2 切换到自动获取直接上网
- echo.
- set /p select=请输入菜单对应数字后回车:
- if /i "%select%" == "1" goto neusoft
- if /i "%select%" == "2" goto auto
- goto menus~
- :neusoft
- cls
- netsh interface ip reset "本地连接"
- echo 设置IP...
- netsh interface ip add address "本地连接" 192.168.20146 255.255.255.0
- echo 设置网关...
- netsh interface ip add address "本地连接" gateway=192.168.2.129 gwmetric=1
- echo 设置DNS...
- netsh interface ip set dns "本地连接" static 202.101.111.41 primary
- del 本地连接
- echo 设置IE代理...
- @echo Windows Registry Editor Version 5.00>>r.reg
- @echo [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings]>>r.reg
- @echo "ProxyEnable"=dword:00000001>>r.reg
- regedit /s r.reg
- del r.reg
- goto exit
- :auto
- cls
- echo 设置IP...
- netsh interface ip set address name="本地连接" source=dhcp
- echo 设置DNS...
- netsh interface ip set dns name="本地连接" source=dhcp
- @echo Windows Registry Editor Version 5.00>>r.reg
- @echo [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings]>>r.reg
- @echo "ProxyEnable"=dword:00000000>>r.reg
- regedit /s r.reg
- del r.reg
- goto exit
- :exit
- cls
- echo.
- cho.
- echo.
- echo.
- echo.
- echo 恭喜!已完成所有设置.
- echo.
- echo.
- echo.
- echo.
- echo.
- echo.
- pause
- exit