通过命令行检查互联网连接图标的状态
您知道 Windows 任务栏上的“Internet 连接”图标吗?拔掉以太网线后经常告诉我们无法连接到互联网的那个?
我想知道是否有一个命令行命令可以告诉我该图标的状态。 (没有互联网/连接,但有黄色警告标志/互联网访问)
不幸的是,ping 外部服务器或检查网络页面无法解决我面临的问题。我的电脑获得了4个不同的IP,其中3个不起作用。所以在与外界联系的时候,我的电脑是没有问题的。但是,当尝试让另一台计算机(cpu2)联系我的计算机时,会出现一些故障,直到 cpu2 尝试工作 IP。不知何故,互联网连接标志能够检测到异常并显示在我的任务栏上。
我寻找这个的原因是因为我正在编写一个脚本(用Java)来获取各种机器信息(RAM、逻辑处理器、浏览器设置、网络双工状态等)。我知道还有更多很棒的选择,但现在请耐心等待:)
谢谢! 乔纳森
You know that "Internet Connectivity" icon on the Windows Taskbar? The one that often tells us we have no connection to the internet after pull out our ethernet cables?
I was wondering if there is a command line command that would tell me the status of that icon. (No internet / Connectivity but with the yellow caution sign / Internet Access)
Unfortunately, pinging external servers or checking the networking page will not fix the problem I am facing. My computer has obtained 4 different IPs, 3 of which do not work. So when contacting the outside world, my computer has no problem. However, when trying to get another computer (cpu2) to contact my computer, there are some failures until cpu2 tries the working IP. Somehow, the Internet connectivity flag is able to detect the anomaly and it shows up on my task bar.
The reason I am looking for this is because I am writing a script (in Java) that grabs various machine information (RAM, logical processors, Browser settings, Network Duplex status, etc etc). I know there are much more awesome alternatives, but just bear with me for now :)
Thanks!
Jonathan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ipconfig
可能正是您所需要的。断开连接将显示“媒体状态:媒体已断开”或类似内容。
ipconfig /all
提供更多详细信息。ipconfig
might be what you need.A disconnected connection will have "Media state: Media disconnected" or similar.
ipconfig /all
gives more details.最简单的互联网连接测试是对已知主机使用 ping。如果您收到
ping www.microsoft.com
的响应,则说明 TCP/IP 和 DNS 正在工作,否则请检查电缆。The easiest test for internet connectivity is to use ping for a known host. If you get a response to
ping www.microsoft.com
then TCP/IP and DNS are working, otherwise check the cable.