批处理修改IP地址的办法

@echo off
for /f "tokens=4*" %%a in ('netsh interface show interface ^| findstr "已连接"') do set "ConName=%%~a"
netsh interface ip set address name="%ConName%" source=static addr=192.168.123.123 mask=255.255.255.0 gateway=192.168.123.1 gwmetric=1
netsh interface ip set dns name="%ConName%" source=static addr=8.8.8.8
netsh interface ip add dns name="%ConName%" addr=114.114.114.114
exit

发表新评论