【发布时间】:2010-12-14 14:09:50
【问题描述】:
我的系统中有多个适配器,我想知道特定适配器的 IP。是否可以通过 Windows 中的命令,在 Linux 中很容易?还是其他方式?
【问题讨论】:
-
调用
ipconfig看起来不像编程(至少对我来说)。
标签: networking
我的系统中有多个适配器,我想知道特定适配器的 IP。是否可以通过 Windows 中的命令,在 Linux 中很容易?还是其他方式?
【问题讨论】:
ipconfig 看起来不像编程(至少对我来说)。
标签: networking
以下将让您指定一个适配器(ipconfig 似乎没有这样做):
netsh interface ip show config name="Local Area Connection"
您可以将| findstr "IP Address" 添加到该命令的末尾以仅显示 IP 地址行。
【讨论】:
netsh interface show interface
以下是我如何获取特定网络适配器的 IP 地址:
for /f "tokens=3 delims=: " %i in ('netsh interface ip show config name^="Ethernet" ^| findstr "IP Address"') do echo Your IP Address is: %i
有关其工作原理的说明,请在此处查看我的相关答案:https://stackoverflow.com/a/59004409/2684661
【讨论】:
ipconfig /all 应该可以解决问题。
【讨论】: