VSCode: Add a directory to the terminal PATH

If your VSCode terminal does not contain the directory location you need in its PATH, you can add it locally to the VSCode settings and it will remain persistent every time you open the IDE.

From the main menu, go to File > Preferences > Settings, and click on the “Open Settings (JSON)” icon shown below.

Add a section, “terminal.integrated.env.linux” that contains a “PATH” key as shown below.  Add your directory path, then a colon and “${env:PATH}” which refers to your system PATH.

 

 

 

 

For other OS flavors, change “.linux” to “.windows” or “.osx”.

If you are on Windows, the directory paths are separated by semicolons (not colon) and backslashes must be double escaped.  For example “c:\\temp\\mydir;${env:PATH}”

You can always add to the system PATH as well, but I wanted to offer an alternative that was localized to the IDE terminal console.

 

 

REFERENCES

stackoverflow, set global PATH in VSCode

NOTES

check PATH in powershell terminal

get-childitem -Path Env:PATH

check PATH in windows command terminal

echo %PATH%