Find MAC Address (GetMac)

Posted Thursday, 29 January 2009 by Misha Hanin
Digg!

GetMAC provides a quick method for obtaining the MAC (Ethernet) layer address. I've created a small script that rerurens a MAC address (Without delimeter). Here is a content of mac.bat:

@Echo off
SETLOCAL
SET MAC=
SET Media=Connected

FOR /F "Tokens=3 Delims= " %%a in ('getmac^|find "Media"') do set Media=%%a

IF /I %Media% == disconnected (
    FOR /F "Tokens=1-6 Delims=- " %%a in ('getmac^|find "Media"') do set MAC=%%a%%b%%c%%d%%e%%f
    )

IF NOT %Media% == disconnected (
    FOR /F "Tokens=1-6 Delims=- " %%a in ('getmac^|find "Device\Tcpip_"') do set MAC=%%a%%b%%c%%d%%e%%f
    )

@echo %MAC%
ENDLOCAL





Reddit!Del.icio.us!Google!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites! title=
 

Add comment

You have no rights to add a new comment. May be you need to register on the site.