@echo off
setlocal enabledelayedexpansion
for /f "tokens=2,3 delims= " %%a in ('ipconfig ^|findstr "以太网"') do (
set/a m+=1
set #!m!=%%a%%b
)
for /f "tokens=2 delims=:" %%a in ('ipconfig ^|findstr "IPv4"') do (
set/a n+=1
set ip!n!=%%a
)
(for /f "tokens=1,2 delims=#=" %%a in ('set #') do echo;%%b!ip%%a!)>"IpList.txt"
pause
不应该for嵌套,及时采纳回答