按win键 查找输入powershell 右键 管理员打开
依次执行如下命令 (将 d:\Programs\Microsoft VS Code\Code.exe 替换为自己的vscode目录)
New-Item ("Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\vscode") -type String -value 'Open with VScode'
New-ItemProperty ("Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\vscode") -name "icon" -value "d:\Programs\Microsoft VS Code\Code.exe" -propertyType string
New-Item ("Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command") -type String -value '"d:\Programs\Microsoft VS Code\Code.exe" "%v"'
删除右键快捷方式
Remove-Item ("Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\vscode")