概述
一鍵快速修改windows系統(tǒng)的IP和DNS采用執(zhí)行xx.bat文件方式,那么xx.bat文件該如何編寫呢?本期文章向各位小伙伴總結(jié)分享 。
實戰(zhàn)演練——如何通過命令修改windows系統(tǒng)的IP和DNS
第1步:采用管理員權(quán)限打開命令提示符(CMD),如下圖所示(windows10操作系統(tǒng));

文章插圖
第2步:在命令提示符中輸入“netsh”,然后,輸入“interface ip”,如下所示;
-C:\Users\007>netsh
netsh>
netsh>interface ip
netsh interface ipv4>
第3步:在“netsh interface ipv4>”視圖中,輸入命令“show interface”查詢系統(tǒng)的可用的網(wǎng)卡信息從而獲取網(wǎng)卡的名稱,如下圖所示;

文章插圖
第4步:在“netsh interface ipv4>”視圖中,輸入命令set address “Ethernet0” dhcp和set dns “Ethernet0” dhcp,配置網(wǎng)卡Ethernet0自動獲取IP地址和DNS地址,默認情況下,永久保存 。如下圖所示;

文章插圖
第5步:查看網(wǎng)卡IP地址和DNS地址的配置效果,在“netsh interface ipv4>”視圖中,輸入命令show address “Ethernet0″和show dns “Ethernet0″,如下圖所示;

文章插圖
以上是關(guān)于windows系統(tǒng)自動獲取IP和DNS的配置方式,那么如何配置靜態(tài)的IP地址和DNS地址呢?
Windows系統(tǒng)配置靜態(tài)IP地址和DNS地址的方式,如下圖所示;

文章插圖
備注:
Windows10系統(tǒng)提供的示例——IP地址配置方式:
set address name=”Wired Ethernet Connection” source=dhcp
set address “Wired Ethernet Connection” static 10.0.0.9 255.0.0.0 10.0.0.1 1
Windows10系統(tǒng)提供的示例——DNS地址配置方式:
set dnsservers name=”Wired Ethernet Connection” source=dhcp
set dnsservers “Wired Ethernet Connection” static 10.0.0.1 primary
實戰(zhàn)演練——如何一鍵修改windows系統(tǒng)的IP和DNS
一鍵修改Windows系統(tǒng)的IP和DNS——DHCP自動獲取
把以下兩條命令復(fù)制到文本文檔中,并另外為dhcp.bat 。(管理員權(quán)限運行dhcp.bat)
【一鍵快速修改win系統(tǒng)的dns 電腦怎么重置dns設(shè)置】 Ethernet0是系統(tǒng)網(wǎng)卡名稱,需要通過命令netsh interface ipv4 show interface提前查詢獲得 。
netsh interface ipv4 set address “Ethernet0” dhcp
netsh interface ipv4 set dns “Ethernet0” dhcp
另存為dhcp.bat方式,如下圖所示;

文章插圖
一鍵修改Windows系統(tǒng)的IP和DNS——靜態(tài)配置
把以下兩條命令復(fù)制到文本文檔中,并另外為static.bat 。(管理員權(quán)限運行static.bat) 。其中,IP地址:192.168.1.100、掩碼:255.255.255.0、網(wǎng)關(guān):192.168.1.254、DNS地址:223.5.5.5 。
netsh interface ipv4 set address “Ethernet0” static 192.168.1.100 255.255.255.0 192.168.1.254
netsh interface ipv4 set dns “Ethernet0” static 223.5.5.5
總結(jié)
以上是一鍵快速修改windows系統(tǒng)的IP和DNS的總結(jié)分享,不足之處,歡迎各位小伙伴留言多多指正 。
推薦閱讀
- 如何快速洗車
- 免費一鍵取消批注模式技巧 word每次打開都有批注框
- 頭發(fā)稀少怎樣快速生發(fā)
- 免費一鍵合成照片方法大全 手機相冊怎么拼圖制作
- 1分鐘簡單快速查詢序列號 硬盤序列號查詢方法
- 3個方法快速給文字添加外框線 word怎么加頁面邊框線條
- 如何快速去粉刺 這些妙招建議收藏
- 一鍵就能將PDF轉(zhuǎn)成Word,如此高效的方法,你不知道多可惜啊
- 怎樣才能快速的睡著覺
- 4步快速修復(fù)聯(lián)想筆記本失靈 thinkpad鍵盤突然全部失靈
