有時候在安裝vscode不會出現鼠標右鍵用vscode打開的情況:
最終要實現的樣子:
解決辦法如下步驟:
1.安裝vscode;
2.新建一個“.reg”為后綴的文件;
3.把下面內容復制到文件中;
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="D:\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"D:\\Microsoft VS Code\\Code.exe\" \"%1\""
; 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\vscode]
@="Open with VSCode"
"Icon"="\"D:\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"D:\\Microsoft VS Code\\Code.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\vscode]
@="Open with VSCode"
"Icon"="\"D:\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"D:\\Microsoft VS Code\\Code.exe\" \"%V\""
D:\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"D:\\Microsoft VS Code\\Code.exe\" \"%1\""
; 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\vscode]
@="Open with VSCode"
"Icon"="\"D:\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"D:\\Microsoft VS Code\\Code.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\vscode]
@="Open with VSCode"
"Icon"="\"D:\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"D:\\Microsoft VS Code\\Code.exe\" \"%V\""
4.把"D:\\Microsoft VS Code\\Code.exe\"換成安裝vscode的路徑
5.把文件名后綴為.reg的文件放到安裝vscode的與vscode.exe同級的文件夾中;
6.雙擊文件名后綴為.reg的文件,彈出詢問是否注冊,點擊確定;
7.回到桌面,鼠標右鍵檢查是否出現上面圖片的樣子;