使用 windows 在 python 中获取友好的设备名称

Getting friendly device names in python with windows

我想使用设备 GUID 获取网络接口名称。

我有一个使用 "ipconfig /all" 和解析接口名称

的答案

但是"ipconfig /all"非常复杂...

所以我想变得像Getting friendly device names in python

但这只显示 usb 驱动程序..

我可以找到GUID(其实我是不知道的)后面的代码:

import netifaces as ni
x=ni.interfaces()
print x

这个节目是这样的['{CDC97813-CC28-4260-BA1E-F0CE3081DEC7}']

我想转换友好的设备名称,例如 "local area connection"

而不是 ipconfig /all 这确实非常复杂,考虑这些更简单,就输出而言,命令:

>netsh interface show interface

Admin State    State          Type             Interface Name
-------------------------------------------------------------------------
Enabled        Connected      Dedicated        Wireless Network Connection
Enabled        Disconnected   Dedicated        Local Area Connection

>netsh interface ip show interfaces

Idx     Met         MTU          State                Name
---  ----------  ----------  ------------  ---------------------------
 13          25        1500  connected     Wireless Network Connection
 12           5        1500  disconnected  Local Area Connection

这些对于解析接口名称应该是微不足道的