有没有命令可以显示活动的以太网连接名称?

问题描述 投票:0回答:2

我需要显示连接的以太网名称。

我使用以下命令来获取 WLAN 连接网络(Wi-Fi)。

C:\Users\User>netsh wlan show interface | findstr /i "SSID"  name
    SSID                   : HOME
    BSSID                  : bc:62:d2:4a:a1:48

如果我接下来运行以下命令,则会输出错误消息:

C:\Users\User>netsh lan show interface command

The Wired AutoConfig Service (dot3svc) is not running.

但是启动服务后,我仍然没有获得活动连接的以太网名称。

C:\Users\User>netsh lan show interface command

There is 1 interface on the system:

    Name             : Ethernet
    Description      : Realtek PCIe GbE Family Controller
    GUID             : e901d916-86f4-4070-9941-47a9a325537a
    Physical Address : 98-E7-43-0F-8F-84
    State            : Connected. Network does not support authentication.

谁能帮我获取有线 LAN 连接上的以太网名称

Home

cmd wifi ethernet ssid
2个回答
4
投票

直接在 中输入以下命令,应在 Windows 8 / Server 2012 操作系统或更高版本上显示连接的网络配置文件的名称,无论它们是有线还是无线。

For /F Tokens^=6^ Delims^=^" %G In ('%SystemRoot%\System32\wbem\WMIC.exe /NameSpace:\\Root\StandardCimv2 Path MSFT_NetConnectionProfile Where "IPv4Connectivity='4'" Get Name /Format:MOF 2^>NUL') Do @Echo %G

,对于 GUI 双击,它看起来更像这样:

@(For /F Tokens^=6^ Delims^=^" %%G In ('%SystemRoot%\System32\wbem\WMIC.exe
 /NameSpace:\\Root\StandardCimv2 Path MSFT_NetConnectionProfile Where
 "IPv4Connectivity='4'" Get Name /Format:MOF 2^>NUL') Do @Echo %%G) & Pause

0
投票

使用

netsh lan
您正在查询有线 (以太网) 接口。 你想要的是无线的。为此,只需使用:
netsh wlan
wlan 代表无线局域网。

© www.soinside.com 2019 - 2024. All rights reserved.