I have some shell scripts, which I would like to execute by name from code during debugging in Visual Studio Code. I need to extend $PATH environment variable to make it happene
According to the documentation, you should use ${env:PATH}
instead of ${env.PATH}
.
On Windows platform I found that Visual Studio Code seems to be case-sensitive. If the name of the variable is not spelled exactly as it is spelled on your machine, Visual Studio Code will ignore your variable from the launch.json.
For example, to properly set path
environment variable when it is spelled Path
, you would need to add the following to launch.json.
"env": {
"Path": "${env:Path};${workspaceFolder}\\node_modules\\.bin"
},
See Launch.json attributes and Variable Substitution in Visual Studio Code documentation for more information. Here what's mentioned there about the variable casing under Variable Substitution:
Note: Be sure to match the environment variable name's casing, for example ${env:Path} on Windows.
This is odd, because Windows is case-insensitive to the names of environment variables
I finally gave up on making that work, but the workaround I have done is to just paste the DOS command to set the path in the terminal before a debugging session. Something like:
set PATH=C:\Python27\Lib\site-packages\pywin32_system32;%PATH%
A little bit ugly, but at least it lets me work. I add that as a comment to my launch.json so I have it readily available. Not completely sure that would transfer cleanly for your Linux environment, but worth a try (with the appropriate syntax changes for the shell you are using, of course).