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.
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 :
- If you have not added WSL support to your portable version of VSCode, Install the extension from here.
- press F1 (Or your configured shortcut, Or Click
View > Command Pallet) to open the Command Palette. - Type
WSLand click onWSL: 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:
- Navigate to the Windows directory where VSCode Portable is installed by entering:
cd /mnt/c/Path/to/Portable/VSCode
- 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.