I added a directory to my PATH but the terminal in my VS Code doesn't recognize a command(exe) that I'm trying to run from that directory. The terminal uses cmd not power shell. What am I missing?
-
Where did you add a directory to your PATH? System level with SETX? Inside VS Code? Did you restart VS Code after adding it? – lit Jul 02 '17 at 18:31
-
At a system level. Not inside VS code and I did restart VS code. – neomib Jul 03 '17 at 13:09
-
Can't reproduce. Not enough information in the question to provide an answer. – Bill_Stewart Jul 03 '17 at 19:36
6 Answers
Restarted my computer and it worked :) Apparently VS Code didn't recognize the changes.

- 3,503
- 4
- 17
- 27
-
2
-
1In my case restarting VSCode didn't help, all built-in terminals didn't see the new PATH value. Singing out and in my Windows account helped. – AKd Mar 19 '23 at 12:23
For me, a simple restart of VSC did the trick.

- 6,100
- 6
- 41
- 47
-
-
Note that 'Restart to Update' does not pick up the new PATH when it starts again. Click X to close the app, check that the VS Code process is not present in Task Manager then open VS Code again, either from shortcut or by entering `code` in a cmd window. Then it picked up the updated PATH. – MikeA Aug 23 '23 at 16:37
If your VS Code terminal shows "Session Restored" after restarting, then it may still be using the variables from before you rebooted! If this happens, close and re-open the vscode window, or kill and restart the terminal tab.

- 754
- 8
- 13
Clicking the bin/trash icon on the terminal to properly kill it and then CTRL + ' to open a new terminal works best. No need to close the app or shut down your PC.

- 2,539
- 3
- 26
- 52
-
A screenshot of this "bin icon" might help (not everyone calls the trash button a "bin"). Also, can do this through the command palette: "**Terminal: Kill the Active Terminal Instance**" and then "**Terminal: Create New Terminal**". – Gino Mempin Jan 26 '22 at 07:16
I had some files remaining in the folder 'c:\Program Files\nodejs', deleted the folder and it all worked.

- 1,455
- 15
- 28
If nothing works and you don't want to restart your computer.
For windows;
- Open a command prompt (outside vscode) and type
echo %PATH%
- Copy the path
- Open your terminal in vscode and type
PATH=<your-path>
(replace <your-path> with the output)
Note: This is a temporary solution and goes away if you close the terminal and open a new one.

- 28
- 6