Launch VS Code from WSL Bash

Auzy picture Auzy · Apr 26, 2017 · Viewed 15.6k times · Source

I have the Creators update installed. WSL is operational. I can execute most .exe files by simply calling notepad.exe But when it comes to VS Code.... I can't use the default code command or call code.exe... I have also tried code and code.cmd. Why doesn't VS Code execute like other programs? And is there a way to enable the code command?

EDIT: I now get these errors:

me@mypc:/mnt/c/Users/me/Documents/project_folder$ code . /mnt/c/Program Files (x86)/Microsoft VS Code/bin/code: line 7: realpath: comma nd not found /mnt/c/Program Files (x86)/Microsoft VS Code/bin/code: line 14: ./Code.exe: No such file or directory

Answer

Auzy picture Auzy · May 2, 2017

The Creators update did install the interop functionality. However, it seems you need to install realpath in WSL in order for the path to be recognized. I'm not sure why this is the case but running sudo apt-get install realpath fixed it for me!

EDIT: After updating to the Fall Creators Update launching VSCode from WSL works out of the box 🎉