Visual Studio Code - "Shell Command: Install 'code' command in PATH command."

Viewed 66910

Consider:

Enter image description here

I just started with Angular. I installed angular/cli and added a project. Now I want to use Visual Studio Code.

I open the Command Palette (Ctrl + Shift + P) and type 'shell command' to find the shell command: Install 'code' command in PATH command.

But I get this message

"No commands matching"

Why does it not exist?

12 Answers

If in Visual Studio Code doesn't appear that option and the installation didn't add to the path directly, you can add the Visual Studio Code bin folder manually to the path and it starts to work.

Go to the Enviroment Variables and edit the Path user variable. Inside of it, add a new variable with the current bin path of your Visual Studio Code installation. Mine, for example, is "C:\Users\Inazio\AppData\Local\Programs\Microsoft VS Code\bin"

Visual Studio Code code command enviroment variable

After that, you can start to use the code command in your OS

I had this same problem. Long story short, I uninstalled VS Code, re-downloaded the installer package and ran that. Sure enough, one of the install screens has a checkbox option to add to the PATH variable and this option is unchecked by default.

Checked the box, finished the install, works fine.

Of course it's perfectly valid to modify the PATH variable after install, but I think it's important to clarify that (at least version 1.23.0) does not update PATH by default. Most of the threads I looked at says it does.

I fixed this just adding "C:\Users\myUser\AppData\Local\Programs\Microsoft VS Code\Code.exe" (where myUser is your windows user) without "" to system path.

same effect than " Shell Command: Install ‘code’ command in PATH ".

This works for me

For Windows users

Open Environment Variables

System > Advance system settings > Advanced tab > environment variables on system variables click on Path and click Edit and add new Path named

"C:\Users\Your-Username\AppData\Local\Programs\Microsoft VS Code\bin"

For window users follow steps below and add new Path, after doing so restart your terminal you will get code command on your terminal

enter image description here

If you already have Visual Code into Windows path and in a terminal you put "code ." and Visual Code starts, what happens is that the command "code" is not linked to the path in wsl2. All you have to do is run the following command changing your user:

sudo ln -s /mnt/c/Users/CHANGE_USER/AppData/Local/Programs/Microsoft
VS\ Code/bin/code /usr/bin/code

This works on Ubuntu and Debian.

it is already installed on Windows. You just have to make cmd path where the project created (e.g C:\WINDOWS\system32> cd C:\WINDOWS\system32\hello-world), then run the the comamnd "code ." like this (C:\Windows\System32\hello-world>code .)

example

I got this from VS Code documentation

the path has been set automatically when installing VS.But i noticed a difference between "code." and "code ." Can you see the difference? The second has space in between the code and the dot. Try that.

I was having the same exact problem and when i checked my PATH variable it said that the path was something\something\Microsoft VS Code . then i remembered my folder's name was Visual Studio Code.After I renamed it back everything works.

Go to Extensions and install Shell. On newer versions you can just type in Code . in CMD and it will pop-up.

Just open your command prompt and type:

cd hello-world

hello-world is the project name don't forget to change it then click (enter) and type

code .

enter image description here

Related