用批处理设置网络连接 以下程序复制保存为.bat格式
@echo off
color 1f
echo.
echo **************************************************
echo *** windows 7自动切换网络 ***
echo *** zhujiang520@126.com ***
echo **************************************************
echo *** 设置IP参数,设置IE代理 ***
echo.
echo.
goto 主菜单
:主菜单
echo 请选择你要的服务:
echo 1、转成公司网络
echo 2、转成公司网络(代理)
echo 3、转成家庭网络
echo 4、转成家庭网络(清除代理)
echo 5、退出
SET /P psn= 请输入 ( ) 中的数字键并按回车:
if /I "%psn%"=="1" goto 公司网络
if /I "%psn%"=="2" goto 公司网络(代理)
if /I "%psn%"=="3" goto 家庭网络
if /I "%psn%"=="4" goto 家庭网络(清除代理)
if /I "%psn%"=="5" goto 退出
:公司网络
echo IP修改成公司网络
echo 正在修改中,请稍后
netsh interface ip set address "本地连接" dhcp
netsh interface ip set dns "本地连接" dhcp
echo OK! IP修改成功!
pause
exit
:公司网络(代理)
echo IP修改成公司网络
echo 正在修改IP地址
netsh interface ip set address name="本地连接" source=static addr=192.168.16.33 mask=255.255.255.0 gateway= 192.168.16.1 gwmetric=1
echo 正在修改DNS服务器
netsh interface ip set dns name="本地连接" source=static addr=202.96.128.86 primary
echo OK! IP修改成功!
echo 正在设置代理服务器……
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.16.100:808" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "" /f
echo 正在刷新设置……
ipconfig /flushdns
pause
exit
:家庭网络
echo IP修改成家庭网络
echo 正在修改IP地址
netsh interface ip set address name="本地连接" source=static addr=192.168.16.33 mask=255.255.255.0 gateway= 192.168.16.1 gwmetric=1
echo 正在修改DNS服务器
netsh interface ip set dns name="本地连接" source=static addr=202.96.128.86 primary
echo OK! IP修改成功!
pause
exit
:家庭网络(清除代理)
echo IP修改成家庭网络
echo 正在修改IP地址
netsh interface ip set address name="本地连接" source=static addr=192.168.16.33 mask=255.255.255.0 gateway= 192.168.16.1 gwmetric=1
echo 正在修改DNS服务器
netsh interface ip set dns name="本地连接" source=static addr=202.96.128.86 primary
echo OK! IP修改成功!
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
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d 0 /f
echo 代理服务器设置已经清空
echo 正在刷新设置……
ipconfig /flushdns
pause
exit
:退出
exit