Prerequisites
Steps to reproduce
Install with aka.ms/install-aishell.ps1.
The script uses the SetEnvironmentVariable method which alters Path's registry key type.
|
$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
Environment data
Version
Latest
Visuals
N/A
Prerequisites
Steps to reproduce
Install with
aka.ms/install-aishell.ps1.The script uses the
SetEnvironmentVariablemethod which altersPath's registry key type.AIShell/tools/scripts/install-aishell.ps1
Lines 133 to 140 in 75e956f
See the issue here.
Consider the below method instead.
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
Version
Latest
Visuals
N/A