1. 程式人生 > 其它 >將VSCode新增至右鍵選單(Windows下)

將VSCode新增至右鍵選單(Windows下)

問題:

  Windows上面安裝Visual Studio Code編輯器後,常常會因為安裝的時候忘記勾選等原因,沒有將"Open with Code(右鍵快捷方式)"新增到滑鼠右鍵選單裡,使用起來多有不便,所以需要我們手動將VSCode新增至滑鼠右鍵選單之中.

解決:

1.新建reg檔案.在桌面上新建一個文字檔案,然後將檔案字尾改為:*.reg,檔名任意,例如:add_shortcut.reg.

2.編寫文字檔案內容.將下面的內容Copy到剛才新建的*.reg檔案中,文字內容如下:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\
*\shell\VSCode] @="Open with Code" "Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe" [HKEY_CLASSES_ROOT\*\shell\VSCode\command] @="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\"" Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\VSCode] @="Open with Code" "Icon
"="C:\\Program Files\\Microsoft VS Code\\Code.exe" [HKEY_CLASSES_ROOT\Directory\shell\VSCode\command] @="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\"" Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode] @="Open with Code" "Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe
" [HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode\command] @="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\""

3.上面程式碼中的地址表示VSCode在電腦上的安裝路徑,如果不是預設安裝的或者路徑不一樣,需要改成和電腦上實際安裝路徑一致的.

4.檔案編輯好了之後儲存關閉.然後雙擊執行add_shortcut.reg ,遇到提示點選 "確定"或"是".不出意外,便大功告成了!