无聊的东东(网络连接.bat)

用批处理设置网络连接 以下程序复制保存为.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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值