批处理设置IP

@echo off
title 静态IP设置
set netName=本地连接
set address=192.168.1.202
netsh interface ipv4 set address name="%netName%"  source=static address=%address% mask=255.255.255.0  gateway=192.168.1.1 gwmetric=0
netsh interface ipv4 set dns name="%netName%" source=static 首选DNS primary
netsh interface ipv4 add dns name="%netName%" addr=备用DNS
netsh interface ip set wins name="%netName%" source=static addr=none
echo 静态IP设置完成 
@echo off
title 动态自动获取IP设置
set name=本地连接
netsh int ip set addr name="%name%" dhcp
netsh int ip set dns name="%name%" dhcp
netsh int ip set wins name="%name%" dhcp
echo 动态自动获取IP设置完成

 

posted @ 2016-08-31 19:25  苦逼IT男  阅读(794)  评论(0编辑  收藏  举报