+ Post New Thread
Results 1 to 9 of 9
Scripts Thread, echo wireless mac address to a file in Coding and Web Development; ive got a script that echos %machinename% and %date% to a text file, but Id like to also include the ...
  1. #1

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,512
    Thank Post
    1,320
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199

    echo wireless mac address to a file

    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?

  2. #2

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,680
    Thank Post
    3,210
    Thanked 1,030 Times in 955 Posts
    Rep Power
    361
    what scripting method are you using ie php ?

  3. #3

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,512
    Thank Post
    1,320
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199
    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?

  4. #4

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,680
    Thank Post
    3,210
    Thanked 1,030 Times in 955 Posts
    Rep Power
    361
    use the find command something like

    ipconfig/all | find "Physical Address"

    maybe replacing Physical Address with wireless ??
    Last edited by mac_shinobi; 28th October 2009 at 07:50 AM.

  5. #5
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    424
    Thank Post
    67
    Thanked 89 Times in 74 Posts
    Rep Power
    61
    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

  6. Thanks to box_l from:

    danrhodes (9th June 2010)

  7. #6

    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    167
    Thank Post
    54
    Thanked 17 Times in 16 Posts
    Rep Power
    21
    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

  8. #7
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    424
    Thank Post
    67
    Thanked 89 Times in 74 Posts
    Rep Power
    61
    Code:
    @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 <EQU 2> 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

  9. 2 Thanks to box_l:

    jcs808 (9th June 2010), OutToLunch (9th June 2010)

  10. #8

    Join Date
    Feb 2006
    Location
    Derbyshire
    Posts
    1,381
    Thank Post
    181
    Thanked 211 Times in 171 Posts
    Rep Power
    65
    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

  11. #9
    danrhodes's Avatar
    Join Date
    Sep 2008
    Location
    Wath Upon Dearne
    Posts
    1,513
    Thank Post
    157
    Thanked 181 Times in 150 Posts
    Rep Power
    67
    Never heard of getmac thanks for the headup.

SHARE:
+ Post New Thread

Similar Threads

  1. Website to find maker of mac address
    By FN-GM in forum Wireless Networks
    Replies: 3
    Last Post: 26th May 2009, 02:54 PM
  2. Mac Address
    By Reaper in forum Wireless Networks
    Replies: 5
    Last Post: 2nd October 2008, 11:17 AM
  3. Get AP Mac Address?
    By Quackers in forum Hardware
    Replies: 7
    Last Post: 7th July 2008, 06:58 PM
  4. Multiple MAC Address
    By Nij.UK in forum Hardware
    Replies: 13
    Last Post: 2nd May 2007, 08:01 AM
  5. Automated Mac Address Retrieval
    By Kained in forum How do you do....it?
    Replies: 12
    Last Post: 27th March 2007, 03:25 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •