Skip to content

Instantly share code, notes, and snippets.

@sglbl
Created June 28, 2022 08:54
Show Gist options
  • Select an option

  • Save sglbl/dbec41151c090c3724f85f2d52b59665 to your computer and use it in GitHub Desktop.

Select an option

Save sglbl/dbec41151c090c3724f85f2d52b59665 to your computer and use it in GitHub Desktop.
Open Vscode with Wsl Batch File
:: ######################################- batch file from github.com/sglbl -##############################################
chcp 1254
@echo off
color 04
title Open VSCode with Wsl option in right click context menu
:: ########################################################################################################################
set "KeyOfOpeningSpesificFolder=HKCR\Directory\shell\Wsl and VSCode"
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%" /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
:: ##########################################Prepared by: Suleyman Golbol####################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment