Quickest post yet; but maybe it will help someone! Because the WSL allows you to call Windows binaries from the Linux system, there’s a quick trick for paths that I’ve run into.

First; where is the filesystem of the linux system on your Windows host? Assuming the Fall Creators Update, installed via the store (Ubuntu in this case):



However, let’s say I have a file test.txt in my home directory that I want to edit using Visual Studio Code. Hmm.

I can type:
code ./test.txt
However, this will pass the argument to the Windows binary unmodified. Darn it. I need to get the path to it from a Windows frame of reference; not the Linux frame of reference..

The trick? Create a new environment variable in your bash profile that exports the full Windows path, which will then be expended by bash prior to passing to the Windows binary.

Like this:

export WIN=C:\\Users\\USENAME\\AppData\\Local\\Packages\\CanonicalGroupLimited.UbuntuonWindows_GUID\\LocalState\\rootfs
(for anyone who wants to copy and paste)

This will then open up code; able to save, and able to use it to edit WSL files. Pretty awesome capability.