获取Mac地址的脚本

1. Windows平台方法

@echo off
echo GET MAC ADDRESS
echo PLEASE WAIT...
getmac /v | find /i "Intel(R)" > mac.txt
getmac /v | find /i "ASIX" >> mac.txt
getmac /v | find /i "Realtek" >> mac.txt
getmac /v | find /i "Qualcomm" >> mac.txt
echo GET MAC ADDRESS SUCCESS
pause
exit

step 1:新建MacAddress.bat文件

step2:复制以上脚本到MacAddress.bat中保存

step3:在cmd命令中执行MacAddress.bat

step4:可以看到生成了一个mac.txt文件

step5:打开mac.txt可以查看到mac

2. Apple的mac本方法

echo 下一行是无线网mac地址 >Desktop/Mac地址.txt
ifconfig | grep -A 4 en0 | grep ether >>Desktop/Mac地址.txt
echo 下一行是有线网mac地址 >>Desktop/Mac地址.txt
ifconfig | grep -A 3 en[1-9]: |grep -A 3 RUNNING,SIMPLEX | grep ether >>Desktop/Mac地址.txt

step 1:新建MacAddress.sh文件

step2:复制以上脚本到MacAddress.sh中保存

step3:在shell中执行MacAddress.sh

step4:可以看到生成了一个Mac地址.txt文件

step5:打开Mac地址.txt可以查看到mac

获取Mac地址的脚本_第1张图片

你可能感兴趣的:(实用小操作)