-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
Install with aka.ms/install-aishell.ps1.
The script uses the SetEnvironmentVariable method which alters Path's registry key type.
AIShell/tools/scripts/install-aishell.ps1
Lines 133 to 140 in 75e956f
| $envPath = $env:Path | |
| if (-not $envPath.Contains($destination)) { | |
| Write-Host "Adding AI Shell app to the Path environment variable ..." | |
| $env:Path = "${destination};${envPath}" | |
| $userPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::User) | |
| $newUserPath = $userPath.EndsWith(';') ? "${userPath}${destination}" : "${userPath};${destination}" | |
| [Environment]::SetEnvironmentVariable('Path', $newUserPath, [EnvironmentVariableTarget]::User) | |
| } |
See the issue here.
Consider the below method instead.
$key = Get-Item 'HKCU:\Environment\'
# Will get the non-expanded values
$existingPath = $key.GetValue('PATH', '', 'DoNotExpandEnvironmentNames')
$newPath = "${existingPath};%TEST_VAR%"
$key.SetValue('PATH', $newPath, 'ExpandString')Expected behavior
`$env:Path` maintains itself as an expand registry key.Actual behavior
`$env:Path` is converted from the registry expand type.Error details
No ErrorEnvironment data
7.5.2Version
Latest
Visuals
N/A
Metadata
Metadata
Assignees
Labels
No labels