轻松切换IP及IE代理设置

来源:互联网 发布:unity3d 2d寻路 编辑:程序博客网 时间:2024/05/01 10:38

  用笔记本的朋友,常常面临者回家上班使用不同网络的情况。每每都需要进行切换。之前我一直使用一个IP切换工具。可是这些工具总是有问题。有的时候除了要切换IP地址,还要切换IE的设置。写了一个小批处理程序可以轻松解决这个问题。呵呵。
回到家里自动上网,到公司设置代理上网,只需要一个程序就可以自动设置完成。

建一个文本文件,修改扩展名为.bat

xip.bat

@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 /"%select%" == "1" goto neusoft
if /"%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
原创粉丝点击