I dumped all the physical network GUIDs to a file via:
wmic nic where "PhysicalAdapter = 'TRUE'" get GUID > networkAdapterGUIDs.txt
When I try to read the file and echo out its contents nothing happens:
for /F "tokens=*" %%A in (networkAdapterGUIDs.txt) do echo %%A
I have tried %%A
with .bat
files and just %A
when running on the command line.
Here's a screenshot of what I'm seeing:
If I could get a simple echo to work I later planned to do something with the lines that have the GUID on them and omit/skip the first line.
I launched up a fresh Windows 8.1 virtual machine and had the same experience. I am currently running Windows 8.
type networkAdapterGUIDs.txt >fixed.txt
(I thinkmore
also works but I'm not sure) and then run your loop over the 'fixed' file. If it helps I will put this as an answerfor /F %%x IN ('wmic nic where "PhysicalAdapter = 'TRUE'" get GUID')
I'm still interested why I couldn't get it to read from a file though, although as you pointed out it could definitely be a file encoding problemfor
(its output contains chars treated as control by batch engine)