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

WinXP 設定雙閘道批次檔快速切換:內網外網一鍵/熱鍵自由切換

編輯:Windows XP 系統介紹

Windows XP 預設單一預設閘道,雙網卡環境下無法同時存取內網與外網。透過 netsh 指令撰寫批次檔(.bat/.cmd),可一鍵或熱鍵快速切換預設閘道,無需繁瑣的介面操作。

批次檔範例(儲存為 switch_gateway.bat)

@echo off
color 0b
echo.
echo ==============================================================
echo  為了優化上網品質,切換網路閘道
echo ==============================================================
echo.
set /p var= 請按任一鍵開始切換...
echo 正在為您更換較快線路,請稍候 .......
netsh interface ip set address name="區域連線" gateway=192.168.1.250 gwmetric=1
echo 切換完成!
pause
  • 將 區域連線 替換為實際網路連線名稱(可用 netsh interface show interface 查詢)。
  • 將 192.168.1.250 替換為目標閘道 IP。
  • 可建立多個批次檔對應不同閘道(如 gateway_intranet.bat、gateway_internet.bat)。

設定熱鍵快速執行

  1. 批次檔右鍵 → 「內容」→「捷徑」索引標籤。
  2. 在「快速鍵」欄位按下組合鍵(如 Ctrl + Alt + 1、Ctrl + Alt + 2),確定。
  3. 以後直接按熱鍵即可切換閘道。

雙閘道切換示意

適用場景:筆電同時連接公司內網(有線)與外網(無線/4G),需快速切換預設路由。Windows 7/10/11 內建支援多閘道度量,無需批次檔;但 XP 此法仍最輕量有效。

Copyright © Windows教程網 All Rights Reserved