Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

VSCode portable, how to integrate it with WSL2?

Windows 11 with WSL2

I use VSCode in portable mode

I want to be able to do $code . inside a WSL2 directory, to be able to open VSCode (in Windows) at that location.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This works automatically if VSCode is "installed" in Windows. But I’m using VSCode in "portable mode".

Any suggestions on how to integrate VSCode portable so that the above works?

>Solution :

  1. If you have not added WSL support to your portable version of VSCode, Install the extension from here.
  2. press F1 (Or your configured shortcut, Or Click View > Command Pallet) to open the Command Palette.
  3. Type WSL and click on WSL: New WSL Window.

VSCode will now open a new window with WSL support, you can now close your current window if you no longer need it and switch to the new one.

EDIT

The code command references your default installation of VSCode so running it will not open your portable version, instead, it will attempt to run the default installed one, to open your portable version from WSL, you will do something like this instead:

  1. Navigate to the Windows directory where VSCode Portable is installed by entering:
cd /mnt/c/Path/to/Portable/VSCode
  1. Finally Run VSCode by entering:
./Code.exe .

I don’t have a Windows PC with me so this is not tested, but tell me how it goes.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading