Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

netsh.exe 指令大全:命令列快速設定 IP、DNS、匯出入網路設定檔

編輯:XP 系統基礎知識

netsh.exe 是 Windows 內建強大的網路設定命令列工具,支援顯示/修改 TCP/IP 設定、切換多組網路環境、設定 DHCP/靜態 IP、WINS、DNS 等,筆電使用者必學。

常用指令速查表

功能指令範例
顯示目前 TCP/IP 設定netsh interface ip show config
設定靜態 IP(本地連線)netsh interface ip set address name="區域連線" static 192.168.0.100 255.255.255.0 192.168.0.1 1
設定 DHCP 自動取得 IPnetsh interface ip set address "區域連線" dhcp
匯出目前網路設定為檔案netsh -c interface dump > c:\location1.txt
匯入網路設定檔netsh -f c:\location1.txt
設定靜態 WINSnetsh interface ip set wins "區域連線" static 192.168.0.200
設定 DNS 為 DHCP 自動取得netsh interface ip set dns "區域連線" dhcp

筆電多網路環境切換實戰

  1. 在網路環境 A 設定好 IP/DNS 後,執行匯出指令存為 location1.txt。
  2. 在環境 B 同樣匯出為 location2.txt。
  3. 切換環境時,以管理員身分執行對應的 netsh -f locationX.txt 即可一鍵套用。
指令中「區域連線」需依實際網路連線名稱調整(可在「網路連線」查看)。所有指令建議在管理員權限的命令提示字元執行。
Copyright © Windows教程網 All Rights Reserved