![我可以在 Windows 7 中右鍵單擊資料夾並選擇“使用 Sublime Text 開啟”嗎?](https://rvso.com/image/1311330/%E6%88%91%E5%8F%AF%E4%BB%A5%E5%9C%A8%20Windows%207%20%E4%B8%AD%E5%8F%B3%E9%8D%B5%E5%96%AE%E6%93%8A%E8%B3%87%E6%96%99%E5%A4%BE%E4%B8%A6%E9%81%B8%E6%93%87%E2%80%9C%E4%BD%BF%E7%94%A8%20Sublime%20Text%20%E9%96%8B%E5%95%9F%E2%80%9D%E5%97%8E%EF%BC%9F.png)
在 Windows 7 中,我可以在命令列中執行此操作:
"c:\Program Files\Sublime Text 2\sublime_text.exe" samplefolder
這將啟動一個 Sublime Text 窗口,其中的內容samplefolder
載入到 Sublime 的側邊欄中。
雖然這可以根據需要工作,但每次都打開命令提示字元很不方便。有什麼方法可以將此行為加入到 Windows 資源管理器的右鍵選單中嗎?我希望能夠右鍵單擊資料夾並“使用 Sublime 打開”,就像右鍵單擊資料夾並“掃描病毒”一樣。
答案1
這是我的 Vim .reg 文件,但它很清楚,只需將 Vim 相關字串替換為 Sublime 的即可。然後另存為.reg 檔案並雙擊導入。
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\vim]
@="&Vim here"
[HKEY_CLASSES_ROOT\Directory\shell\vim\command]
@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\vim]
@="&Vim here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vim\command]
@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" \"%V\""
有兩個資料夾上下文選單,一個是直接右鍵單擊資料夾,即前兩行,另一個是在資料夾空白區域右鍵單擊,即最後兩行。我不知道最後一個是什麼%V
意思,也沒有找到任何相關的東西,它只是有效。
編輯:
對於 Windows 7 上預設安裝的 Sublime Text 2,以下是完整程式碼。另存為whatever.reg
並雙擊。
Windows Registry Editor Version 5.00
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\" \"%1\""
; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime]
@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime\command]
@="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\" \"%V\""
答案2
安裝說明:
- 下載
OpenWithSublimeTextAsAdmin.bat
文件的要點。 - 將其複製到 Sublime Edit 安裝資料夾中(通常為 C:\Program files\Sublime Text 3 或類似資料夾)
- 運行。
特徵:
- 安裝超簡單。
- 使用 Sublime Text 開啟文件
- 使用 Sublime Text 以提升的權限開啟檔案。當您想要編輯 ie 系統檔案時,這特別方便。
- 使用 Sublime Text 開啟資料夾
答案3
這就是我所做的
我安裝記事本替代品並將其指向我的sublime_text.exe
(或任何其他文字編輯器)。
然後,我添加“用記事本打開”註冊表設定(將以下內容複製並貼上到文件中.reg
,然後雙擊以應用它。
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Open with Notepad]
[HKEY_CLASSES_ROOT\*\shell\Open with Notepad\command]
@="notepad.exe %1"
Notepad Replacer 的作用是取代要開啟的任何命令(系統範圍)以開啟notepad.exe
您在安裝中指定的文字編輯器(在本例中sublime_text.exe
)。
如果您卸載記事本替換器或重新安裝它並指向不同的文字編輯器,您的「用記事本開啟」上下文功能表仍然可以使用新的預設文字編輯器!
答案4
您應該能夠打開 regedit.exe 並瀏覽到:
HKEY_CLASSES_ROOT*\shell
右鍵單擊“shell”並選擇建立新密鑰,將其命名為“Open with Sublime Text”。
在該鍵下方建立一個名為「command」的新鍵。
雙擊右側窗格中的(預設)值並輸入以下內容:
[Sublime Text .exe 名稱] %1