新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本篇内容主要讲解“用批处理脚本实现ip地址切换”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“用批处理脚本实现ip地址切换”吧!
创新互联凭借在网站建设、网站推广领域领先的技术能力和多年的行业经验,为客户提供超值的营销型网站建设服务,我们始终认为:好的营销型网站就是好的业务员。我们已成功为企业单位、个人等客户提供了成都网站建设、网站建设服务,以良好的商业信誉,完善的服务及深厚的技术力量处于同行领先地位。代码如下:
@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 配置结束
到此,相信大家对“用批处理脚本实现ip地址切换”有了更深的了解,不妨来实际操作一番吧!这里是创新互联建站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!