来源:自学PHP网 时间:2015-04-17 17:13 作者: 阅读:次
[导读] Win批处理开机自动设置IP地址@echo off www.2cto.com REM select=1,网卡IP将被设置成172.16.200.34,select=2,网卡IP将被设置成192.168.0.5ping -n 2 192.168.0.254 set select=2 || set ......
Win批处理开机自动设置IP地址 @echo off www.2cto.com
REM select=1,网卡IP将被设置成172.16.200.34,select=2,网卡IP将被设置成192.168.0.5
ping -n 2 192.168.0.254 && set select=2 || set select=1
REM 获取网卡名称
for /f "skip=4 tokens=3* delims= " %%i in ('ipconfig') do (
set adapter=%%i
goto out
)
:out
set adapter=%adapter::=%
if %select%==1 (
netsh int ip set address name="%adapter%" static 172.16.200.34 255.255.255.0 172.16.200.1 1
netsh int ip set dns name="%adapter%" static 202.102.224.68 primary
netsh int ip add dns name="%adapter%" 202.102.227.68 index=2
) else (
netsh int ip set address name="%adapter%" static 192.168.0.5 255.255.255.0 192.168.0.254 1
)
echo 设置完成,按任意键退出!
pause >nul 2>nul
|
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com