SoFunction
Updated on 2025-04-09

Batch Network Configuration Information Viewer


@echo off
:: Code writing: secretkeyboard Code revision
::Call format:
call :select "ip address" "ip"
call :select "Physical Address" "mac"
call :select "Default Gateway" "gateway"
call :select "DNS Servers" "dns"
call :select "Description" "netcard"
:: Demo effect
echo.
echo.
echo Welcome to use the network configuration information viewer
color a
echo.
echo.
echo.
echo native IP:%ip%
echo native MAC:%mac%
echo native DNS:%dns%
echo gateway IP:%gateway%
echo network card name: %netcard%
ipconfig /all >d:\
echo.
echo has already stored this information D:\
echo 000000000000000000000000000000000000000000000000000000000000000000000
pause>nul
goto :eof
::**************************************************************
:: parse ipconfig command to output common functions
::**************************************************************
:select
for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i /c:%1') do if not "!%~2!" == "" set "%~2=%%i"
goto :eof