ITeye博客

写个批处理文件自动配置IP地址

cjx186 · 2013-11-18 19:45 · NOTE · 非技术 · Markdown

echo #设静态IP
netsh interface ip set address name="本地连接" source=static addr=192.168.1.20 mask=255.255.255.0
echo #设默认网关
netsh interface ip set address name="本地连接" gateway=192.168.1.1 gwmetric=0
echo #设首选dns
netsh interface ip set dns name="本地连接" source=static addr=192.168.1.1 register=PRIMARY
echo #设备用dns
netsh interface ip add dns name="本地连接" addr=211.90.88.129 index=2
netsh interface ip set wins name="本地连接" source=static addr=none
echo #
echo #显示“本地连接”配置结果
netsh interface ip show config 本地连接
echo #
echo # "本地连接" 的接口 IP  配置
echo #设自动获取ip
netsh interface ip set address name="本地连接" source=dhcp 
echo #设自动获取dns
netsh interface ip set dns name="本地连接" source=dhcp register=PRIMARY
echo netsh interface ip set wins name="本地连接" source=dhcp
echo #显示“本地连接”配置结果
netsh interface ip show config 本地连接
echo # 接口 IP 配置结束

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。