Skip to content

Windows Store version can't modify PATH #14957

@brunovieira97

Description

@brunovieira97

Steps to reproduce

PS> $path = [Environment]::GetEnvironmentVariable('Path', 'User)
PS> $newPath = "<add new entry here>;$path"
PS> [Environment]::SetEnvironmentVariable('Path', $newPath, 'User')

Expected behavior

User's PATH content is altered and verifiable through System Properties > Environment Variables

Actual behavior

PowerShell 7 reports the new value for the User's PATH.

User's PATH remains the same on every software (Windows PowerShell, for example) and System Properties > Environment Variables.

Example, showing C:\Users\bruno\foo is on my PATH (I've added it using steps documented above) according to PowerShell 7 downloaded from Microsoft Store:

PS> [Environment]::GetEnvironmentVariable('Path', 'User')

C:\Users\bruno\foo;C:\Users\bruno\scoop\apps\gpg\current\bin;C:\Users\bruno\scoop\apps\nodejs\current\bin;C:\Users\bruno\scoop\apps\nodejs\current;C:\Users\bruno\scoop\shims;C:\Users\bruno\AppData\Local\Microsoft\WindowsApps;C:\Users\bruno\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\bruno\AppData\Local\Programs\Azure Data Studio\bin

If I go to System Properties, PATH is different, not showing the path I added through PS7:
image

Some important notes:

  • New value is always shown in PowerShell 7 only
  • This does not occur with PS 7 installed through MSI, only MS Store version
  • This happens independently of Terminal used (ConHost and Windows Terminal tested)
  • Occurs even after launching a new instance (of Windows Terminal AND PS 7, tested that)
  • New PATH is never shown in System Properties or Windows PowerShell, even after launching new instances, logging out or rebooting the PC
  • Only way to revert the PATH on PS 7 (so it has the same value as the System Properties one) is editing it through PS 7, as no other way contains the bugged content

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.2
PSEdition                      Core
GitCommitId                    7.1.2
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productWG-Maintainers-Buildspecific to affecting the build

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions