My computer crashed and I had to reinstall my system today.
I’m running Windows 10 with VS Code and I’m using Debian (WSL) as my main terminal.
I have installed VS Code with the "Add to PATH" option and I have activated the Windows Subsystem for Linux in PowerShell.
I can use the command "code" in CMD and PowerShell but when I try to run it in Debian I get
"-bash: code: command not found"
, as far as I understand it should work straight away when installing with the "path" option? At least according to this article: https://dev.to/ajeet/the-ultimate-guide-to-use-vs-code-with-windows-subsystem-for-linux-wsl-51hc
I have also tried installing the "Remote Development" extension, but I’m still facing the same problem.
3
Answers
Try adding the following line to the
.bashrc
file in your$HOME
directory (~/.bashrc
).Where you replace
$USER
with your Windows username.Alternatively, you can create an alias and add it to your
.bashrc
file:Where you replace
$COMMAND
with a name of your choice and$PATH
with the path to the executable.You can set an alias in bashrc like:
Where
distro_name
is your WSL distro name.You can check your distro name in PowerShell by using:
Refer to the documentation.