You need a few more lines, something like this should work (just a
base, to be tested and adapted to your needs):
CODE
@ECHO OFF
SET Whattofind=%1
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
SET /A DCounter=0
FOR /f "tokens=2 delims=:" %%A in ('IPCONFIG /ALL ^|FIND "Descr"') do (
REM ECHO %%A
SET /A DCounter=!DCounter!+1
SET Nic_Descr_!DCounter!=%%A
)
SET /A ICounter=0
FOR /f "tokens=2 delims=:" %%A in ('IPCONFIG /ALL ^|FIND "IP."') do (
REM ECHO %%A
Set /A ICounter=!ICounter!+1
SET Nic_IP_!ICounter!=%%A
)
FOR %%A in ( 1 2 3 4 5 6 7 8 9) DO (
IF DEFINED Nic_Descr_%%A SET Nic_Descr_%%A=%%A:!Nic_Descr_%%A:~0,30!:!Nic_IP_%%A!
FOR /F "tokens=1,2,3 delims=:" %%B IN ('ECHO !Nic_Descr_%%A!^|FIND /I "%Whattofind%"') DO ECHO %%C : %%D
)
This accepts one parameter that has to be part of the description string for the NIC.
jaclaz
P.S.: Please note that in the second FOR loop there is a full stop in the search string FIND "IP."' , that I need on Italian OS, for English it should be removed.