Last active
May 28, 2024 07:30
-
-
Save sglbl/18bcd1c1c79c7ee32d5617e62db6017c to your computer and use it in GitHub Desktop.
Open WSL with VSCode on Context Menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :: ######################################- batch file from github.com/sglbl -############################################## | |
| chcp 1254 | |
| @echo off | |
| color 04 | |
| title Open VSCode with Wsl option in right click context menu | |
| set "VscodeIcon=C:\Program Files\Microsoft VS Code\Code.exe" | |
| :: ######################################################################################################################## | |
| set "KeyOfOpeningSpesificFolder=HKCR\Directory\shell\Wsl and VSCode" | |
| REG ADD "%KeyOfOpeningSpesificFolder%" /v "Icon" /t REG_EXPAND_SZ /d "%VscodeIcon%" | |
| REG ADD "%KeyOfOpeningSpesificFolder%" /ve /t REG_EXPAND_SZ /d "Open VSCode with Wsl" | |
| REG ADD "%KeyOfOpeningSpesificFolder%\command" /ve /t REG_EXPAND_SZ /d "wsl --cd \"%%V\" code . " | |
| :: ######################################################################################################################### | |
| set "KeyOfOpeningCurrentFolder=HKCR\Directory\Background\shell\Wsl and VSCode" | |
| REG ADD "%KeyOfOpeningCurrentFolder%" /v "Icon" /t REG_EXPAND_SZ /d "%VscodeIcon%" | |
| REG ADD "%KeyOfOpeningCurrentFolder%" /ve /t REG_EXPAND_SZ /d "Open VSCode with Wsl" | |
| REG ADD "%KeyOfOpeningCurrentFolder%\command" /ve /t REG_EXPAND_SZ /d "wsl --cd \"%%V\" code ." | |
| :: ######################################################################################################################### | |
| pause>nul | |
| exit /b |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save the content as a .bat file.
Run as administrator.