window10直接使用cmd设置本机ip与dns
手动设置
管理员模式下
#IP地址 子网掩码 网关
netsh interface ip set address name="适配器名称" static 192.168.1.61 255.255.255.0 192.168.1.100
#DNS
netsh interface ip set dns name="以太网" static 58.22.96.66
netsh interface ip add dns name="以太网" 218.104.128.106 index=2
netsh interface ip set dns name="以太网" static 203.190.97.33
netsh interface ip add dns name="以太网" 203.190.96.33 index=2
#检查状态
netsh interface ip show config
一键脚本
###一键设置 DNS 的批处理(.bat)脚本
@echo off
:: 设置网络接口名称
set interfaceName="以太网"
:: 设置主 DNS 服务器
set primaryDNS=203.190.96.33
:: 设置备用 DNS 服务器
set secondaryDNS=203.190.97.33
:: 设置主 DNS
netsh interface ip set dns name=%interfaceName% static %primaryDNS%
:: 添加备用 DNS
netsh interface ip add dns name=%interfaceName% %secondaryDNS% index=2
:: 显示设置结果
echo DNS 服务器已设置为:
echo 主 DNS: %primaryDNS%
echo 备用 DNS: %secondaryDNS%
pausewindow10直接使用cmd设置本机ip与dns
https://blog.883051.xyz/archives/window10zhi-jie-shi-yong-cmdshe-zhi-ben-ji-ipyu-dns