欢迎来到入门教程网!

DOS/BAT

当前位置:主页 > 脚本语言 > DOS/BAT >

ip地址切换批处理脚本分享

来源:本站原创|时间:2020-01-10|栏目:DOS/BAT|点击:

复制代码 代码如下:

@echo off
rem # ----------------------------------
rem # 接口 IP 配置       
rem # ----------------------------------

echo "=========IP 控制管理=========="
echo "=> d: 自动获取IP"
echo "=> h: 寝室 IP地址:66.168.1.8"
echo "=> r: 公司网络 IP地址:192.168.250.173"
echo "请输入对应的序号d,h,r,按回车键结束: "
set /p ch=
if %ch%==""  echo "You input null"&goto :EOF
set case=d,h,t,w>nul
echo %case%|findstr "\<%ch%\>">nul&if errorlevel 1  goto :err
goto %ch%
goto err

:h
:: "寝室"
echo "configure home ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地连接" static 66.168.1.8 255.255.255.0 66.168.1.1 1 >nul
@netsh int ip set dns  "本地连接"  static  66.168.1.1  PRIMARY >nul
echo home ip configure is done
goto :EOF

:r
:: "公司网络"
echo "configure transport ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地连接" static 192.168.250.173 255.255.255.0 192.168.250.1 1 >nul
echo transport ip configure is done
goto :EOF

:d
:DHCP "自动获取IP地址"
echo "configure transport ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地连接"  dhcp >nul
@netsh int ip set dns  "本地连接"  dhcp   >nul

:err
:: "error"
echo your input "%ch%" ,no this argument ! please input h or w!  game over
rem # 接口 IP 配置结束

上一篇:Windows设置开机自启动bat脚本

栏    目:DOS/BAT

下一篇:用批处理一键安装两种扩展名的Windows系统补丁

本文标题:ip地址切换批处理脚本分享

本文地址:https://www.xiuzhanwang.com/a1/DOS_BAT/10236.html

网页制作CMS教程网络编程软件编程脚本语言数据库服务器

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

Copyright © 2002-2020 脚本教程网 版权所有