How to extend $PATH in launch.json in Visual Studio Code?

后端 未结 3 946
难免孤独
难免孤独 2021-02-08 01:34

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

3条回答
  •  粉色の甜心
    2021-02-08 02:21

    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

提交回复
热议问题