windows-8 - 如何在 Windows 8 中使用命令提示符设置/更改 DNS

标签 windows-8 dns command-prompt

如何在 Windows 8 中使用命令提示符或 bat 文件设置 DNS 设置

我尝试过这个:

netsh interface ip set dns name="Local Area Connection" source=static addr=none

但没有工作。

最佳答案

首先,网络名称可能是“以太网”,而不是“本地连接”。要查找名称,您可以执行以下操作:

netsh interface show interface

这将在“接口(interface)名称”列下显示名称(此处以粗体显示):

Admin State    State          Type             Interface Name
-------------------------------------------------------------------------
Enabled        Connected      Dedicated        Ethernet

Now you can change the primary dns (index=1), assuming that your interface is static (not using dhcp):

netsh interface ipv4 add dnsserver "Ethernet" address=192.168.x.x index=1
<小时/>

2018 更新 - 该命令将与 dnsserver(单数)或 dnsservers(复数)配合使用。以下示例使用后者并且也是有效的:

netsh interface ipv4 add dnsservers "Ethernet" address=192.168.x.x index=1

关于windows-8 - 如何在 Windows 8 中使用命令提示符设置/更改 DNS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18620173/

相关文章:

html - Windows 8 邮件应用程序未显示订阅/取消订阅超链接?

具有自定义域名的 SaaS 应用程序的 SSL 设置

c# - 使用特定机器对域进行身份验证?

unix - 将终端选项卡标题设置为 unix 中的提示名称

c# - 如何使用C#在WinRT上使用Google Analytics API

visual-studio - 为 Windows 8 Metro 和 Windows Phone 设置项目/解决方案的最佳方法是什么?

windows-8 - 在 Windows 8 Metro 中隐藏虚拟键盘

.net - 为什么我本地 WCF 客户端的 IP 不是 127.0.0.1?

c# - 如何在命令提示符下运行 selenium c# test?

windows-7 - 如何在Windows命令提示符下同时启动2个程序