Click here for important information about

Batch - Show a dhcp-table with Status

By: hidde663
February 2, 2017

::Save as dhcp.bat
::Displays the full dhcp-table for your network
::call this .bat from cmd.exe
::parameters are -4 or -6 for ipv4/ipv6
::add the path of the file to PATH or place it in %windir%\system32
::example1: dhcp -4
::example2: call C:\******\dhcp.bat -4
setlocal EnableDelayedExpansion
if '%1'=='/?' echo Parameters -4 of -6 can be given, to give ipv4/6 output&exit /b
if '%1'=='-4' set param=-4
if '%1'=='-6' set param=-6
if '%1'=='' set param=
for /f "delims=\" %%a in ('net view ^| findstr "\\"') do (
for /f "tokens=2 delims=[]" %%A in ('ping %param% -n 1 %%~na') do (
set "check=%%A"&if not "!check:~16,1!"=="" (set "space=    -    ") else (set "space=            -    ")
for /f "tokens=2 delims=(%%" %%1 in ('ping -n 1 %%a') do if '%%1'=='100' (set state=DOWN) else (set state=UP)
if '"%COMPUTERNAME%"'=='"%%~na"' (echo !state!    %%A!space!%%~na    [YOU]) else (echo !state!    %%A!space!%%~na))))

Need more help?
Describe your Problem
Example: Hard Drive Not Detected on My PC

Ask Question