Cheat Sheet - WSL

Make WSL run services at startup

In WSL, the linux distributions run only after a first linux command is invoked. If you wanna run a linux daemon (a service) you must configure the server in linux and run any command in that linux distribution.

Path mapping

WSL supports launching Windows application executables (such as iTunes) from within the shell. However, as was mentioned in the comments, lnk files are not supported, since they aren’t executables. They are links to executables.

WSL also is nice enough to (by default) append your Windows path to your Linux path. So for applications that are in the path (e.g. notepad.exe), you can just launch them directly with the appname.exe format.

For apps that aren’t in the path (e.g. itunes.exe), you’ll need to determine the location of the actual .exe (executable), and launch it with the full path. This is really the same as for any Linux executable under Linux, or any Windows executable under Windows PowerShell or CMD.

To find the full path to iTunes, just right click on the lnk file in Explorer and choose “Properties”. The “Target” field will have something like C:\Program Files\iTunes\iTunes.exe.

As mentioned previously, if you were trying to launch this in Windows PowerShell you would still need the full path, so you would run:

C:\Program Files\iTunes\iTunes.exe

To launch that particular path in bash in WSL, you would use:

/mnt/c/Program\ Files/iTunes/iTunes.exe

If you need help converting the Windows path to the Linux path, there’s a command for that:

wslpath 'C:\Program Files\iTunes\iTunes.exe'

If you want to open a file with its default program (like xdg-open) run:

# Open current directory
wslview .

# Open file
wslview my.pdf

For detailed information on Windows/WSL interoperability, see this doc.