Skip to content

Instantly share code, notes, and snippets.

@naazeri
Last active June 27, 2024 10:18
Show Gist options
  • Save naazeri/a3c107fefdaac4d2829ab80fb619fb52 to your computer and use it in GitHub Desktop.
Save naazeri/a3c107fefdaac4d2829ab80fb619fb52 to your computer and use it in GitHub Desktop.
add "Open in VS Code" in windows folder's context menu. run it with Administrator cmd.exe. remember to use your VSCodePath PATH instead of mine
@echo off
SET "VSCodePath=C:\Users\reza\AppData\Local\Programs\Microsoft VS Code\Code.exe"
SET "VSCodeIcon=%VSCodePath%,0"
REM Add context menu for directories with icon
reg add "HKCR\Directory\shell\OpenWithVSCode" /ve /d "Open in VS Code" /f
reg add "HKCR\Directory\shell\OpenWithVSCode" /v "Icon" /d "%VSCodeIcon%" /f
reg add "HKCR\Directory\shell\OpenWithVSCode\command" /ve /d "\"%VSCodePath%\" \"%%V\"" /f
REM Add context menu for directory background with icon
reg add "HKCR\Directory\Background\shell\OpenWithVSCode" /ve /d "Open in VS Code" /f
reg add "HKCR\Directory\Background\shell\OpenWithVSCode" /v "Icon" /d "%VSCodeIcon%" /f
reg add "HKCR\Directory\Background\shell\OpenWithVSCode\command" /ve /d "\"%VSCodePath%\" \"%%V\"" /f
echo Context menu entries for Visual Studio Code with icon have been added successfully.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment