Small Business Susan

For those who dislike Vista’s excessive ‘IPconfig /all’ output

Done an IPconfig /all in Vista yet?  Freaked you out yet?

From the www.activedir.org listserve comes this gem: 

Per the subject line, I put this together to trim the output to something that resembles XP’s ‘ipconfig /all’.
Hope it proves useful to someone …

Regards,
Dean Wells




:: Windows Vista IPconfig parser / Dean Wells, MSEtechnology – March, 2007
:: – parses output from ‘IPconfig /all’ and filters anything other than what I deem as the most IPv4 relevant configuration

@echo off

setlocal ENABLEDELAYEDEXPANSION

:: Define needed environment
set tmpFILE=%TEMP%\%~n0.tmp
set startPARAGRAPH=FALSE
set inPARAGRAPH=FALSE
set generalFILTER=IPv6 IAID WINS Autoconfiguration

:: Issue IPconfig command, redirect output to tmpFILE; parse file, filter out generalFILTER, grab remaining lines and call parse function
IPconfig /all >%tmpFILE%

for /f “tokens=* delims=” %%l in (‘type %tmpFILE% ^| findstr /v “%generalFILTER%”‘) do (
call :linePARSER “%%l”
)

goto :END

:linePARSER
:: Get arguments; alter likely/possible CMD.EXE special-meaning/incompatible characters
set ARGS=%*
set ARGS=%ARGS:”=%
set ARGS=%ARGS:(=[%
set ARGS=%ARGS:)=]%

:: If we’ve hit the first paragraph or a paragraph for either a Wireless or Ethernet adapter or we’re already committed –> display what we’re given
if “%ARGS:~0,24%”==”Windows IP Configuration” (
set inPARAGRAPH=TRUE
set startPARAGRAPH=TRUE
) else (
if /i “%ARGS:~0,8%”==”Wireless” (
set inPARAGRAPH=TRUE
set startPARAGRAPH=TRUE
) else (
if /i “%ARGS:~0,8%”==”Ethernet” (
set inPARAGRAPH=TRUE
set startPARAGRAPH=TRUE
) else (
if /i “%ARGS:~0,3%”==”PPP” (
set inPARAGRAPH=TRUE
set startPARAGRAPH=TRUE
) else (
if “%inPARAGRAPH%”==”TRUE” (
if  not “%ARGS:~0,3%”==”   ” (
set inPARAGRAPH=FALSE
)
)
)
)
)
)

:: Determine if the line should be displayed according to %inPARAGRAPH%
if “%inPARAGRAPH%”==”TRUE” (
if “%startPARAGRAPH%”==”TRUE” (
echo/
echo %ARGS%
echo/
set startPARAGRAPH=FALSE
) else (
echo %ARGS%
)
)
goto :EOF

:END
del /f %tmpFILE% 2>nul


1 comment so far ↓

  • #   Ryan on 03.26.07 at 1:20 pm     

    how is this used?