Super User is a question and answer site for computer enthusiasts and power users. 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

Given the batch script below. How would I be able to give me a MAC address with no dashes and add a "D" in front of it? So when I go and paste, it has a MAC address that starts with a D and there are no dashes? Possibly even using what I copied to automatically change the computer name with it using newsid?


FOR /f "tokens=12 delims= " %%a IN ('IPCONFIG /all^|FINDSTR "Physical Address"') DO (
    SET PA=%%a
    IF NOT "%PA%"=="." GOTO Done


ECHO The Physical Address has been copied to the clipboard.
share|improve this question
I think this page has the relevant info on stripping the dashes. ..not sure about appending the D. – CreeDorofl Apr 5 '11 at 2:26

Use echo D%PA:-=%|clip instead.

Note though, that you're getting the last MAC address on your computer which could really be anything. At least on my machine that doesn't correspond to any phsyical interface.

share|improve this answer
Thank you that worked! I only have one NIC on the machines, no wireless or virtual NICs. – Dasutin Apr 5 '11 at 10:59

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.