Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 查找macaddress的等效windows命令_Linux_Windows_Mac Address - Fatal编程技术网

Linux 查找macaddress的等效windows命令

Linux 查找macaddress的等效windows命令,linux,windows,mac-address,Linux,Windows,Mac Address,我使用以下linux命令查找macaddress "ifconfig | grep enp0s20f6 | awk '{print $5}'" 找到macaddress的等效windows命令应该是什么 在linux中,使用grep和awk过滤ifconfig的结果。有没有办法修改等效的windows命令以仅获取macaddress?对于windows: C:\>ipconfig /all Windows IP Configuration Host Name . .

我使用以下linux命令查找macaddress

"ifconfig | grep enp0s20f6 | awk '{print $5}'"
找到macaddress的等效windows命令应该是什么

在linux中,使用grep和awk过滤ifconfig的结果。有没有办法修改等效的windows命令以仅获取macaddress?

对于windows:

    C:\>ipconfig /all
    Windows IP Configuration
   Host Name . . . . . . . . . . . . : PC-10234
   Primary Dns Suffix  . . . . . . . : mydomain.com

   DNS Suffix Search List. . . . . . : mydomain.com
                                       mydomain.com
Wireless LAN adapter Wireless Network Connection:
   Connection-specific DNS Suffix  . : mydomain.com
   Description . . . . . . . . . . . : Intel(R) Centrino(R) Advanced-N 6205
   Physical Address. . . . . . . . . : 3C-99-88-64-A1-F0

Ethernet adapter Local Area Connection:
   Connection-specific DNS Suffix  . : mydomain.com
   Description . . . . . . . . . . . : Intel(R) 82579LM Gigabit Network Connection
   Physical Address. . . . . . . . . : 73-2B-4F-D5-12-A0

C:\>
或 有关更多详细信息,请访问此处-

要仅获取mac地址,可以执行以下操作

for /f "usebackq tokens=3 delims=," %a in (`getmac /fo csv /v ^| find "Local Area Connection"`) do set MAC=%~a
请按此处-

显示macadresses

for /F "delims=: tokens=2" %a IN ('netsh lan show interfaces^|findstr /C:"Physical address"') do @echo %a
如果在批处理文件中使用,则需要将百分比加倍

for /F "delims=: tokens=2" %%a IN ('netsh lan show interfaces^|findstr /C:"Physical address"') do @echo %%a
您可以对ipconfig执行相同的操作,但计算机可以具有虚拟\隧道接口,ipconfig将显示这些接口,这可能会导致额外的零行

for /F "delims=: tokens=2" %%a IN ('ipconfig /all^|findstr /C:"Physical address"') do @echo %%a

要查找MAC,只需在linux中更改findstr的参数,我过滤结果并只获得macaddress。有没有办法通过修改ipconfig只获取macaddress/all@Prem跟贴似乎有你想要的东西。
for /F "delims=: tokens=2" %%a IN ('ipconfig /all^|findstr /C:"Physical address"') do @echo %%a