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

Win7 右鍵選單新增「用 gVim 編輯」:修改登錄檔關聯任意文字編輯器

編輯:Windows 7 系統介紹

想在 Windows 7 右鍵選單直接用 gVim(或 Notepad++、VS Code、Sublime Text 等)開啟任意檔案?透過修改 HKEY_CLASSES_ROOT\*\shell 登錄鍵值即可實現。

操作步驟

  1. 開啟 regedit,定位至:
    HKEY_CLASSES_ROOT\*\shell
  2. 右鍵 shell → 「新增」 → 「項目」,命名為 gvim(或編輯器名稱)。
  3. 選中 gvim 項目,右側預設值雙擊,數值資料輸入:
    用 gVim 編輯
    (這是右鍵選單顯示的文字)
  4. 右鍵 gvim → 「新增」 → 「項目」,命名為 command。
  5. 選中 command,雙擊預設值,數值資料輸入 gVim 完整路徑 + 參數:
    "C:\Program Files (x86)\Vim\vim72\gvim.exe" "%1"
    • %1 會自動替換為右鍵點選的檔案完整路徑。
    • 路徑含空白請用雙引號包裹。
  6. 確定,即時生效(無需重開機)。

通用模板(適用任意編輯器)

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\YourEditorName]
@="用 &YourEditorName 編輯"

[HKEY_CLASSES_ROOT\*\shell\YourEditorName\command]
@="\"C:\\Path\\To\\YourEditor.exe\" \"%1\""

另存為 AddEditorToContextMenu.reg 雙擊匯入即可批量部署。

進階:僅針對特定副檔名

將路徑改為 HKEY_CLASSES_ROOT\.txt\shell\... 或 HKEY_CLASSES_ROOT\txtfile\shell\...,即可限定特定檔案類型顯示該選項。

移除方式

在 regedit 中刪除對應的 shell\YourEditorName 項目即可。

Copyright © Windows教程網 All Rights Reserved