-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Bug Report
When using Add-Path -TargetEnvVar, the current session environment is not updated correctly.
Current Behavior
The new path is added to the user profile, or to the system, in the requested target variable, but it is also added to the session PATH instead of the session target variable.
Expected Behavior
The target variable should be updated instead of PATH.
Possible Solution
Replace the hardcoded PATH with the value of $TargetEnvVar:
Lines 115 to 119 in b588a06
| # current session | |
| $inPath, $strippedPath = Split-PathLikeEnvVar $Path $env:PATH | |
| if (!$inPath -or $Force) { | |
| $env:PATH = (@($Path) + $strippedPath) -join ';' | |
| } |