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

為可執行檔新增搜尋路徑:透過註冊表實現「執行」命令直呼程式名

編輯:XP 系統基礎知識

DOS 時代靠 autoexec.bat 設 PATH,Windows 可更隱蔽地透過註冊表為特定程式註冊路徑。以 WinRAR 為例:

  1. 開啟 regedit,展開 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths(無則新建)。
  2. 新建項目 WinRAR.exe,修改其「預設」字串值為完整路徑:C:\Program Files\WinRAR\WinRAR.exe。
  3. 同項下新增字串值 Path = C:\Program Files\WinRAR。

完成後,「執行」輸入 WinRAR.exe 或 WinRAR 即可直接啟動。

進階技巧

  • 使用環境變數:NT/2000/XP 可用 %ProgramFiles%\WinZip\WinZip32.exe 替代絕對路徑,增強可攜性。
  • 修改既有程式路徑:同法可覆寫已註冊程式的啟動路徑。
  • 長檔名路徑加雙引號:路徑含長檔名(>8 英文/4 中文字元)時,**整個路徑須用雙引號括起**,舊版 Windows 否則無法定位(XP/2003 已不限制)。

善用 App Paths,讓常用工具隨喚隨用,無須污染系統 PATH 環境變數。

Copyright © Windows教程網 All Rights Reserved