
You could redirect the output to a file and then store it in an environment variable with the setx command. In this example, the MAC address of the PC with the IP 192.168.23.214 is displayed in CSV format (parameter /fo csv) and in verbose mode (/v). It is easy to use, supports remote queries, and can display results in a structured format: getmac /s 192.168.23.214 /fo csv /v The built-in Windows tool getmac is the perfect choice for this purpose. Using ipconfig is cumbersome and is not an option if you have to read the MAC addresses remotely. The second call finds all remaining lines with the IDs. The first call of findstr removes all lines with empty MAC addresses. To shorten the search results, you should use a filter: ipconfig /all|findstr /V 00-00-00|findstr Physical This is particularly true if your machine contains multiple (virtual) adapters. To display the MAC address, you have to use the parameter /all, which spits out a clutter of information. In most blogs and forums, ipconfig is recommended for reading the MAC address. Ipconfig: often recommended but unsuitable
