开发者

Get list of 'Friendly interface names' on a Mac (Airport, Ethernet, etc)

开发者 https://www.devze.com 2023-01-20 14:48 出处:网络
I\'m developing an application in RealBASIC, but I need the list of interfac开发者_如何学JAVAe names to populate a dropdown box.

I'm developing an application in RealBASIC, but I need the list of interfac开发者_如何学JAVAe names to populate a dropdown box.

Parsing ifconfig didn't work (got eth0, eth1, lo, etc.). I need the name that is displayed in system preferences (Ethernet, Airport, etc.).

Is there a terminal command that I can parse?


networksetup -listallnetworkservices will give you just the names (with an asterisk before disabled ports, in case you want to leave them out). networksetup -listnetworkserviceorder gives some additional info, like what /dev entry (en0, etc) they correspond to. Check the man page for networksetup for even lots more options...

0

精彩评论

暂无评论...
验证码 换一张
取 消