关于批处理修改网卡ip以及网关,dns

 

 

代码

@echo 正在设置 本地连接 的IP,请耐心等待!
@echo off   
rem 可以指定要修改的网卡名称
set NIC="本地连接"
rem 设置ip,已经网关
set IP="192.168.7.27"
set MASK="255.255.0.0"
set GW="192.168.1.1"
set GM=1
rem dns 也可以使用set DNS1, set DNS2来分别设置主副dns
set DNS="218.85.152.99"
@netsh interface ip 
set address name=%NIC% source=static addr=%IP% mask=%MASK% gateway=%GW% gwmetric=%GM%
@echo on
@echo IP环境设置完毕 请核对ip...
@ipconfig 
@echo ...
@echo ..
@echo .
@netsh interface ip 
set dns name=%NIC% source=static addr=%DNS% 
@netsh interface ip add dns name
="本地连接" addr=%DNS2%
@netsh interface ip 
set wins name="本地连接" source=static addr=none
@
goto end
:end
@echo 设置完毕
exit

 

 

posted @ 2010-04-01 15:54  valuel  阅读(580)  评论(0)    收藏  举报