@echo off
echo 正在设置网络参数,请不要操作。
echo 获取MAC地址
for /f "tokens=12 delims= " %%i in ('ipconfig/all^|find /i "phys"')do if not defined m set "m=%%i"
if not exist C:\自动填写ip md C:\自动填写ip
echo %m%>C:\自动填写ip\a.txt
echo 计算IP地址
(for /f "tokens=2 delims==" %%i in ('findstr /g:a.txt b.txt') do (
echo %%i
))>c.txt
echo 正在设置IP及子网掩码
cmd /c netsh interface ip set address name="本地连接" source=static addr=%C% mask=255.255.255.0 gateway=192.168.70.1 gwmetric=1
echo 正在设置DNS服务器
cmd /c netsh interface ip set dns name="本地连接" source=static addr=202.99.96.68 register=PRIMARY
taskkill /f /im excel.exe /t
del C:\自动填写ip\a.txt
exit