Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

@ECHO OFF

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

:Done

ECHO %PA%| CLIP
CLS
ECHO The Physical Address has been copied to the clipboard.
ECHO.
PAUSE
EXIT
share|improve this question
    
I think this page has the relevant info on stripping the dashes. robvanderwoude.com/bht.php#Strip ..not sure about appending the D. –  CreeDorofl Apr 5 '11 at 2:26
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.