(view source code of listdhcp.bat as plain text)
@ECHO OFF
IF NOT "%OS%"=="Windows_NT" GOTO Synatx
IF NOT "%~1"=="" IF /I NOT "%~1"=="/NH" GOTO Syntax
SETLOCAL ENABLEDELAYEDEXPANSION
IF /I NOT "%~1"=="/NH" ECHO DHCP Server Network adapter
FOR /F "tokens=*" %%A IN ('NETSH Diag Show DHCP') DO (
FOR /F "tokens=2* delims=[]" %%B IN ("%%~A") DO (
SET Adapter=%%C
)
FOR /F "tokens=2 delims==" %%B IN ("%%~A") DO (
SET DHCPServer=%%B
ECHO.!DHCPServer:~1! !Adapter:~1!
SET Adapter=
)
)
ENDLOCAL
GOTO:EOF
:Syntax
ECHO.
ECHO ListDHCP.bat, Version 1.00 for Windows XP and later
ECHO List DHCP servers for all network adapters
ECHO.
ECHO Usage: LISTDHCP [ /NH ]
ECHO.
ECHO Where: /NH (No Header) prevents display of table header
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" COLOR 00
page last modified: 2024-04-16; loaded in 0.0057 seconds