@echo off
::备份相关网络配置
netsh -c interface dump > c:\old_net_info.txt
for /f "tokens=2" %%a in ('systeminfo^|findstr "连接名"') do (set NIC=%%a)
for /f "tokens=2" %%b in ('systeminfo^|findstr "01]%: "') do (set IP=%%b)
set MASK="255.255.252.0"
set GW="10.153.96.1"
set GM=1
echo %NIC%
echo %IP%
echo %MASK%
echo %GW%
echo %GM%
@echo 正在修改网络配置的子网掩码、网关.......
::修改现有机器的子网掩码和网关地址
netsh interface ip set address %NIC% static %IP% %MASK% %GW% %GM%
echo ------------------------------------
echo %NIC%的设置已全部完成,配置如下:
echo IP地址:%IP%
echo 默认网关:%GW%
echo 子网掩码:%MASK%
echo ---------------------------
pause