Exporting CMD To TXT Files For PC Cloning

Until recently I had never had a reason to copy the contents of a command prompt into a text file. That was until I had just finished imaging 30 HP Stream laptops and they didn’t say they needed the MAC ids until I was done.  (A side note for these HP Streams is it does not seem like they are currently able to PXE boot from a fog server. At least not with the Ethernet to USB adapter I was using so instead of ordering 10 different adapters to see if any would work we just used Clonezilla with a samba option.)

The question is what is the fastest way to get the MAC ids from 30 laptops freshly imaged with Windows 10. They needed the MAC ids to add them to the hidden Wi-Fi network in the building they would be going to.  Also, all the laptops were currently turned off and in their boxes so they would have to be turned back on long enough to get the info.

Option one was to write it down on paper but that does not sound very fast and would not be in a digital format. Option two take a picture of the numbers with my phone. That’s a little faster but traps the numbers in an image that isn’t copy and paste-able. There had to be a script or batch file I could run from a USB stick. Option three create a .bat file with the line ipconfig /all  > setting.txt. This option works but is saving all the IP info when I just need the MAC ids and it is only saving it for one computer. Then I found the magic append feature by using 2 “>>” instead of just 1 “>” and the code of getmac instead of ipconfig /all.

The final and best option for me was creating a .bat file with the line getmac >> settings.txt and saving that to a USB stick. It took more time to turn the laptops back on than it did to get the info saved to the memory stick. I was satisfied with this last option which took maybe about 20 minutes altogether but I’m open to hearing some alternative solutions if you have any.


  1. Powershell? Would need them all online, mind you.

    gwmi win32_networkadapter | select MACAddress

    Or gwmi win32_networkadapter -computername **comma-sep…assetnames** | select MACAddress | out-file c:\Temp\MAC

Leave a Reply