批处理修改IP地址/子网掩码/网关/DNS/WINS - 洛阳翼展电脑


批处理修改IP地址/子网掩码/网关/DNS/WINS

2019-8-3 乱云飞

@ echo off 
rem 设置变量 
set Nic=本地连接 
set Addr=192.168.1.188
set Mask=255.255.255.0 
set Gway=192.168.1.1
set Dns1=114.114.114.114
set Dns2=8.8.8.8
set Wins1=192.168.1.1
set Wins2=192.168.1.1 
rem //以上依次为IP地址、子网掩码、网关、首选DNS、备用DNS、首选WINS、备用WINS 
echo ------------------------------------------------------ 
echo 正在进行网络设置,请稍等...
echo. IP地址 = %Addr% 
echo. 子网掩码 = %Mask% 
netsh interface ip set address name=%Nic% source=static addr=%Addr% mask=%Mask% >nul 
echo. 网关 = %Gway% 
netsh interface ip set address name=%Nic% gateway=%Gway% gwmetric=1 >nul 
echo. 首选DNS = %Dns1% 
netsh interface ip set dns name=%Nic% source=static addr=%Dns1% register=PRIMARY >nul 
echo. 备用DNS = %Dns2% 
netsh interface ip add dns name=%Nic% addr=%Dns2% index=2 >nul 
echo. 首选WINS = %Wins1% 
netsh interface ip set wins name=%Nic% source=static addr=%Wins1% register=PRIMARY >nul 
echo. 备用WINS = %Wins2% 
netsh interface ip add wins name=%Nic% addr=%Wins2% index=2 >nul 
echo ------------------------------------------------------ 
echo IP设置完成! 
cmd /k

本文链接:http://80c.cc/ez/232.html

发表评论:

预ICP备10086-001号 © 翼展网/80C.CC 技术支持/洛阳翼展科技
TEL / 13213610060 QQ / 345794501
Powered by emlog