Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I have a small problem and need some help. We need to quickly find the MAC addresses of machines and all we have is the hostname.
We have been using the getmac /s \\computername command to get the mac address of a single hostname.
I have a text file which has lots of hostnames in it (150) one per line e.g.
hostname1
hostname2
hostname3I am using the following command
getmac /s hostname1 /u domain\user /p password /fo csv /nh >> ThisFile.txt
My question is, is there anyway to loop through the file using each line of the file as the hostname for example in the form of a variable. I'm not too hot with batch scripting so not great with loops any help would be much appreciated!!
TIA
d4rkcell

Non-Command Script version:
FOR /F %a IN (SomeTextFile) DO getmac /s %a /u domain\user /p password /fo csv /nh >> ThisFile.txtSomeTextFile's name cannot contain spaces.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |