Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

te #34420

Closed
xlebenny opened this issue Sep 15, 2017 · 6 comments
Closed

te #34420

xlebenny opened this issue Sep 15, 2017 · 6 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@xlebenny
Copy link

xlebenny commented Sep 15, 2017

It's sound look like can set environment variables by "terminal.integrated.env.windows" config

  • VSCode Version: 1.16.1
  • OS Version: Windows 10

Steps to Reproduce:

  1. File > Preference > Setting, save with below text
    {
    "terminal.integrated.env.windows": {
    "foo": "bar"
    }
    }

  2. View > Integrated Terminal

  3. input echo $foo in Terminal

Output:
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\bar> echo $foo
PS C:\bar>

Expected Output:
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\bar> echo $foo
bar <---- because configed in terminal.integrated.env.windows
PS C:\bar>

Reproduces without extensions: Yes

@vscodebot vscodebot bot added the extensions Issues concerning extensions label Sep 15, 2017
@alexdima
Copy link
Member

@xlebenny Can you please write steps for your problem ?

@alexdima alexdima added info-needed Issue requires more information from poster and removed extensions Issues concerning extensions labels Sep 15, 2017
@xlebenny
Copy link
Author

xlebenny commented Sep 15, 2017

Updated @alexandrudima , but which setting trigger stackovewflow copy my post to here?

@yume-chan
Copy link
Contributor

yume-chan commented Sep 24, 2017

In PowerShell, $foo means a local variable named foo, and $env:foo means an environment variable named foo.

I have confirmed that echo $env:foo does work.

@xlebenny
Copy link
Author

@yume-chan i tried below is work for me

"terminal.integrated.env.windows": {
    "foo": "bar"
}
PS C:\bar> echo $env:foo
bar

but, how to append variable instead of replace?

"terminal.integrated.env.windows": {
    "path": "$Env:Path;C:\\new\\path"
}
PS C:\bar> echo $Env:Path
$Env:Path;C:\new\path

@yume-chan
Copy link
Contributor

yume-chan commented Sep 25, 2017

See #34337. There is currently no way to do that.

${env:Name} is supported in tasks.json, can it be extended to settings.json? @Tyriar

EDIT: I also found #32273 that's a feature request.

@Tyriar
Copy link
Member

Tyriar commented Sep 25, 2017

Closing as duplicate of #34337

@yume-chan I'll reopen the issue with syntax similar to tasks.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants