Skip to content

Conversation

@xworld21
Copy link

Description

The functions Add-Path, Remove-Path admit an argument -TargetEnvVar which would update the correct profile or system environment variable, but would always act on PATH in the current session.

I simply replaced $env:PATH with Get/Set-Content "env:$TargetEnvVar" to fix this. I have also updated the message 'Adding (...) to your path', so there will be a visible change to 'Adding (...) to your PATH'.

(I suppose this doesn't merit an entry in the CHANGELOG... does it?)

Motivation and Context

Closes #6579.

How Has This Been Tested?

I have checked the functions manually in the terminal, including with non-existing variables (hence the -ErrorAction Ignore).

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant