@echo off
echo -------------------------------------------------
echo WIN7系统请以管理员身份运行本批处理脚本
echo -------------------------------------------------
netsh interface ip set address "本地连接" static 172.18.1.2 255.255.0.0 172.18.1.1
netsh interface ip set dns "本地连接" static 202.103.224.68
netsh interface ip add dns "本地连接" 202.103.225.68
echo 设置成功。
echo IP:172.18.11.2
echo 网关:172.18.1.1
echo 子网掩码:255.255.255.0
pause
------------------------------------------------------------------------------------------------------------------
@echo off
echo -------------------------------------------------
echo WIN7系统请以管理员身份运行本批处理脚本
echo -------------------------------------------------
@echo off
rem eth :://设置网卡名称,如"本地连接"
set eth="本地连接"
rem sleep ::设置后面的等待时间,如"20秒"
set sleep=ping -n 20 127.0.0.1>nul 2>nul
echo 正在更改为自动获取IP地址...
netsh interface ip set address "%eth%" source=dhcp
echo 正在更改为自动获取DNS地址...
netsh interface ip set dns "%eth%" source=dhcp
echo ----------------------------------------
echo 更改成功
::ipconfig /all
pause
close