ip地址切换批处理脚本分享
来源:本站原创|时间:2022-11-25|栏目: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 配置结束
您可能感兴趣的文章
- 01-10使用批处理实现软件的自动安装以安装搜狗拼音为例
- 01-10通过批处理修改DNS的代码(推荐)
- 01-10windows使用批处理发布web到tomcat并启动tomcat脚本分享
- 01-10再谈DOS批处理下格式化日期字符串的三种方法(详解)
- 01-10用批处理一键安装两种扩展名的Windows系统补丁
- 01-10批处理杨辉三角效果实现代码
- 01-10将批处理文件注册成服务在系统启动的时候自动调用
- 01-10批处理输出n阶幻方脚本
- 01-10dos批处理文件中的变量小结
- 01-10批处理自动打系统补丁(批量安装exe文件)