RabbieBurns Posted October 28, 2009 Posted October 28, 2009 ive got a script that echos %machinename% and %date% to a text file, but Id like to also include the wirless mac address if possible too.. Is it possible?
mac_shinobi Posted October 28, 2009 Posted October 28, 2009 what scripting method are you using ie php ?
RabbieBurns Posted October 28, 2009 Author Posted October 28, 2009 dos command line echo %machinename% %time% >> blah.txt Ive got it at the minute just dumping the entire ipconfig /all output to a file, but wouldnt mind just the mac address Is there a way to do it with the net sh command?
mac_shinobi Posted October 28, 2009 Posted October 28, 2009 (edited) use the find command something like ipconfig/all | find "Physical Address" maybe replacing Physical Address with wireless ?? Edited October 28, 2009 by mac_shinobi
box_l Posted October 28, 2009 Posted October 28, 2009 Hi, Have a look at Getmac and this page How to get MAC address from command line / batch file in Vista? - microsoft.public.win2000.cmdprompt.admin | Google Groups or just type getmac /? at the CMD prompt to see if you have it already. they should help. regards, BoX 1
jcs808 Posted June 8, 2010 Posted June 8, 2010 Giving an old thread a bump. I've used getmac to output to a text file. Here's the command I used: getmac /FO CSV /NH>c:\%computername%.txt and here's the output: "40-61-86-07-16-00","\Device\Tcpip_{8677B475-2070-4AFE-8EFD-D8ABE83A3C17}" "08-00-27-00-04-C3","\Device\Tcpip_{B6BA71F4-66D0-4965-AFCE-FD065B7129AB}" What command do I use to add the computer name to the end of the output? e.g. "40-61-86-07-16-00","\Device\Tcpip_{8677B475-2070-4AFE-8EFD-D8ABE83A3C17}","mypc" "08-00-27-00-04-C3","\Device\Tcpip_{B6BA71F4-66D0-4965-AFCE-FD065B7129AB}","mypc" Thanks
box_l Posted June 8, 2010 Posted June 8, 2010 @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION getmac /FO CSV /NH>c:\%computername%temp.txt SET name=%computername% REM Line count required SET LineCount=0 REM Read from file. value will read 2 lines FOR /F "tokens=*" %%A IN ('TYPE "c:\%computername%temp.TXT" 2^>NUL') DO ( SET /A LineCount+=1 rem ECHO Read "%%A" with a LineCount of !LineCount! SET Value!LineCount!=%%A IF /I !LineCount! EQU 2 GOTO DoneReading ) :DoneReading ECHO %Value1%,"%name%" > c:\%computername%.txt ECHO %Value2%,"%name%" >> c:\%computername%.txt REM Tidy dummy file DEL c:\%computername%temp.txt should do what you want. BoX 2
OutToLunch Posted June 9, 2010 Posted June 9, 2010 All the years I've been doing ipconfig /all and trawling back up through the millions of extra adapters Vista etc spit out, can't believe I never knew about getmac. Cheers all
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now