I have always had issues understanding how VSCode process environment variables on Windows. Currently, I am trying to integrate Cmder with VSCode as my shell using the json below that I found on Github:
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.env.windows": {
"CMDER_ROOT": "[cmder_root]"
},
"terminal.integrated.shellArgs.windows": [
"/k",
"%CMDER_ROOT%\\vendor\\bin\\vscode_init.cmd"
],
I was trying to replace "[cmder_root]"
with a variable defined in the OS but cannot get VSCode to recognize it. When I create the variable as a System variable, if I run set
at the cmd.exe prompt of the integrated terminal, it shows the new variable name and the value I set it to but VSCode won't use it because it will not start Cmder when I open a terminal.
If I define the variable in the OS as User variable, running set
inside the integrated terminal no longer displays that variable with the value I set it to. It displays it as CMDER_ROOT=%CMDER_ROOT%
.
I finally got Cmder to work by hard coding the path in the settings.json file but it just made me want to find out what I am doing wrong.