批处理设置ip等

来源:百度知道 编辑:UC知道 时间:2024/05/25 05:48:28
@ECHO off
netsh interface ip set address name="本地连接" source=static addr=10.160.13.55 mask=255.255.255.0
echo IP和子网掩码设置完成
netsh interface ip set address name="本地接"gateway=10.160.13.254 gwmetric=0
echo 网关设置完成........
netsh interface ip set dns name="本地连接" source=static addr=10.1.3.5 register=PRIMARY
echo DNS1设置完成........
netsh interface ip add dns name="本地连接" addr=10.210.62.12
echo DNS2设置完成........
netsh interface ip add dns name="本地连接" addr=10.210.62.12
echo DNS2设置完成........
netsh interface ip set wins name="本地连接" source=static addr=none

为什么运行后提示DNS指定了无效的接口,设置不了??其它的都ok,

@ECHO off
netsh interface ip set address name="本地连接" source=static addr=10.160.13.55 mask=255.255.255.0
echo IP和子网掩码设置完成
netsh interface ip set address name="本地连接" gateway=10.160.13.254 gwmetric=0
echo 网关设置完成........
netsh interface ip set dns name="本地连接" source=static addr=10.1.3.5 register=PRIMARY
echo DNS1设置完成........
netsh interface ip add dns name="本地连接" addr=10.210.62.12
echo DNS2设置完成........
netsh interface ip set wins name="本地连接" source=static addr=none

你试下。OK的。 本地连接少打了个连。。。。 后面还少了个空格
有两遍DNS2 去掉一个。