diff --git a/src/pwsh-install.ps1 b/src/pwsh-install.ps1 index 1553e83..e32e1d0 100644 --- a/src/pwsh-install.ps1 +++ b/src/pwsh-install.ps1 @@ -86,6 +86,11 @@ function Update-PowerShellProfile([string]$Path, [bool] $Install, [bool] $UseBom return } + $profile = Get-Item -LiteralPath $Path -Force -ErrorAction Ignore + if ($profile -and $profile.ResolvedTarget) { + $Path = $profile.ResolvedTarget + } + # Get-Content uses .NET's StreamReader, so it auto-detects UTF-8/UTF-16 with BOM. $text = Get-Content -LiteralPath $Path -Raw -ErrorAction Ignore if (!$text) {