不用進控制台逐點滑鼠,netsh 指令配合批次檔(.bat)即可一鍵切換靜態 IP、DHCP、DNS 設定,筆電多地點移動辦公必備。
netsh interface ip set address name="連線名稱" source=static|dhcp [addr] [mask] [gateway] [gwmetric]
netsh interface ip set dns name="連線名稱" source=static|dhcp [addr] [register=none|primary|both] [index=編號]
static 手動、dhcp 自動。auto。none/primary/both)。| 需求 | 指令 |
|---|---|
| 設定靜態 IP | netsh interface ip set address name="區域連線" static 192.168.1.100 255.255.255.0 192.168.1.1 1 |
| 改回 DHCP | netsh interface ip set address name="區域連線" dhcp |
| 手動設定單一 DNS | netsh interface ip set dns name="區域連線" static 168.95.1.1 primary |
| 手動設定多組 DNS | netsh interface ip set dns name="區域連線" static 168.95.1.1 index=1netsh interface ip add dns name="區域連線" 139.175.10.20 index=2 |
| DNS 改回 DHCP | netsh interface ip set dns name="區域連線" dhcp |
.bat。詳細參數說明請輸入 netsh /? 查詢。善用批次檔讓網路環境切換變成雙擊即完成的動作。