Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get a batch file to output some data to a CSV file. The command I have works perfectly in the command line but not when I copy it to a batch file. In the batch file, it just hangs and keeps looping.

Here is the command:

getmac /fo csv /nh >> C:\Users\ohje1001tech\Desktop\test.csv

What I am trying to do is run this script on all the new lab computers that we have and generate a list of mac addresses that we can use to reserve IPs in the DHCP server.

Ideally I would like the computer name as well but thats not really needed.

share|improve this question
What does your batch file actually look like? Is it just this one line? Also - what version of windows are you running this on? – Rex Mar 11 '14 at 15:08
Yes, it is just the one line. Am I missing some syntax? I am running win 7 pro. – user2363217 Mar 11 '14 at 15:20
Having just this line in a batch file will not loop. It might hang if something goes wrong, but there is no technical way for it to loop unless you are calling this batch file from something else. – Rex Mar 11 '14 at 15:23

Make certain your batch file is not called "getmac.bat" or "getmac.cmd" -- it is probably making a recursive call to itself.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.