Skip to content

Integrated PowerShell terminal %PATH% environment variable not matching PowerShell ones #74606

@TomasHubelbauer

Description

@TomasHubelbauer

This is a very weird issue, but one, which causes me real problems (basically, as a result of this issue, I cannot use npm start in a project of mine anymore).

When I run $Env:Path in normal PowerShell terminal window (not the VS Code integrated terminal) and I check the results, it perfectly matches system and user variables as seen in Computer > Manage > Environment Variables according to this algorithm:

  • Take all system variables
  • Take all user variables except for ones already present in system (but take ones duplicate in user)

This is probably some internal PowerShell behavior for resolving PATH from system and user variables, it's not that important really, the important thing is:

In the VS Code integrated terminal using PowerShell, when running $Env:Path and comparing that to the system and user values - at least in my case, I find that the system values are repeated several times and not as a whole set of values in the system PATH variable, but instead there are like three different chunks from the system PATH (incomplete, not the whole set shuffled) which all repeat several times in random order.

That along is very weird to me, but that is not the whole issue, on top of that, not all user PATH values show up!

I know this is hard to imagine, so I will attach the output of all 4: user PATH, system PATH, VS Code integrated PowerShell terminal PATH and PowerShell proper PATH. You can see the VS Code file is missing C:\Users\tohubelb\Desktop\%PATH%.

I am not sure how, but somehow my npm start problem is related to this, because it works in normal PowerShell but not the VS Code one.

Is this a known issue, integrated PowerShell terminal missing user PATH values and having such a weird PATH as opposed to normal PowerShell?

  • VSCode Version: 1.34.0 and 1.35.0-insider
  • OS Version: Windows 10, version 1809, build 17763.437

Steps to Reproduce:

  1. In Code: $Env:Path > code.txt and then replace ; with \n
  2. In PowerShell: $Env:Path > pwsh.txt and then replace ; with \n
  3. Compare

pwsh-core.txt
system.txt
user.txt
code.txt
code-insiders.txt
pwsh.txt

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugterminalGeneral terminal issues that don't fall under another label

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions