Vscode: environment variables no longer valid in workspace settings.json or tasks.json

Created on 4 Apr 2019  路  12Comments  路  Source: microsoft/vscode


  • VSCode Version: 1.33.0
  • OS Version: Ubuntu 18.0.4

Steps to Reproduce:

  1. put some variables in EG: ${env:PATH}
    "terminal.integrated.env.linux": {
        "DATA": "${env:PATH};${workspaceFolder}/xtensa-esp32-elf/bin",
    }
  1. echo out that variable in the integrated terminal

echo $DATA

;/home/bird/deako/goat/xtensa-esp32-elf/bin

Does this issue occur when all extensions are disabled?: Yes

*duplicate

Most helpful comment

I can confirm the same experience after upgrading to 1.33.0 on Windows.

Version: 1.33.0 (user setup)
Commit: 0dd516dd412d42323fc3464531b1c715d51c4c1a
Date: 2019-04-04T15:14:46.685Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT ia32 10.0.17134

All 12 comments

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

  • ${env:PATH} never works in terminal when no files/folders opened. (#70323)

i should note that the above example works fine for me on 1.32.3

I can confirm the same experience after upgrading to 1.33.0 on Windows.

Version: 1.33.0 (user setup)
Commit: 0dd516dd412d42323fc3464531b1c715d51c4c1a
Date: 2019-04-04T15:14:46.685Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT ia32 10.0.17134

same here in tasks.json. On macOS.

Edit: replacing ${env:HOME} with ${HOME} fixed my problem. It that the new way of doing it ?

@sebirdman This issue is happening throughout, ${env:*} is not working anywhere in vs code. May be syntax has changed or something is missing in tasks.json documentation.

Experiencing the same issue here with

Version: 1.33.0 (user setup)
Commit: 0dd516dd412d42323fc3464531b1c715d51c4c1a
Date: 2019-04-04T15:14:28.026Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763

My current setup in c:\Users\Ricardo\AppData\Roaming\Code\User\settings.json is

...
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
    "terminal.integrated.env.windows": {
        "PATH": "${env:PATH}"
    },
...

It was working before I updated VSCode this morning.
Will be following this issue, as I couldn't find an answer in the related issues.

Same issue here:

Version: 1.33.0 (user setup)
Commit: 0dd516dd412d42323fc3464531b1c715d51c4c1a
Date: 2019-04-04T15:14:28.026Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134

same here in tasks.json. On macOS.
Edit: replacing ${env:HOME} with ${HOME} fixed my problem. It that the new way of doing it ?

I think what you see happening is ${HOME} being interpreted by your shell, not VSCode. For instance, on Windows I have WSL set as the shell for a project, and ${HOME} evaluates to /home/user, and ${LOCALAPPDATA} to nothing. I need to be able to evaluate ${env:LOCALAPPDATA}, but that is no longer possible.

Any fix for windows?

Same issue here on Windows. And I was doing a demo for a client (which failed as a result on this particular point). That was rather awkward. It would be great if the VS Code team could solve this.

Looks like #72029

/duplicate #72029, fyi @alexr00

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TurkeyMan picture TurkeyMan  路  411Comments

hsdk123 picture hsdk123  路  263Comments

fabiopicchi picture fabiopicchi  路  192Comments

Tekbr picture Tekbr  路  191Comments

Tyriar picture Tyriar  路  204Comments