- @echo off
- setlocal enabledelayedexpansion
- for /f "tokens=*" %%a in ('ipconfig /all ^| findstr /C:"IP Address" /C:"Description" /C:"Physical" ') do (
- set var=%%a
- if /i "!var:~,11!"=="Description" (set /a n+=1)
- set str=!var:*:=!
- set "str=!str:~,-1!" //去掉行末的回车符Cr,以免影响输出
- for %%i in (!n!) do set _%%i=!_%%i!!str!& if /i "!var:~,10!"=="IP Address" echo [!n!]!_%%i!
- )
复制代码
|