如何在 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/