$ErrorActionPreference = 'Stop' if (-not ($IsWindows -or $PSVersionTable.PSEdition -eq 'Desktop')) { return } $LauncherPath = Join-Path $HOME '.local\bin\start-claude-proxy.ps1' $ProgramsPath = [Environment]::GetFolderPath('Programs') if ([string]::IsNullOrWhiteSpace($ProgramsPath)) { Write-Warning 'Start Menu Programs folder was not found.' return } $ShortcutPath = Join-Path $ProgramsPath 'Claude Proxy.lnk' $PwshAliasPath = Join-Path $env:LOCALAPPDATA 'Microsoft\WindowsApps\pwsh.exe' $PwshCommand = Get-Command pwsh -ErrorAction SilentlyContinue if (Test-Path -LiteralPath $PwshAliasPath) { $TargetPath = $PwshAliasPath } elseif ($null -ne $PwshCommand) { $TargetPath = $PwshCommand.Source } else { $TargetPath = 'pwsh.exe' } $Arguments = "-NoLogo -NoProfile -ExecutionPolicy Bypass -File `"$LauncherPath`"" $WorkingDirectory = $env:USERPROFILE $ClaudeExecutable = Join-Path $env:LOCALAPPDATA 'AnthropicClaude\claude.exe' if (Test-Path -LiteralPath $ClaudeExecutable) { $IconLocation = "$ClaudeExecutable,0" } else { $IconLocation = "$TargetPath,0" } New-Item -ItemType Directory -Path (Split-Path -Parent $ShortcutPath) -Force | Out-Null $Shell = New-Object -ComObject WScript.Shell $Shortcut = $Shell.CreateShortcut($ShortcutPath) $Changed = $false if ($Shortcut.TargetPath -ne $TargetPath) { $Shortcut.TargetPath = $TargetPath $Changed = $true } if ($Shortcut.Arguments -ne $Arguments) { $Shortcut.Arguments = $Arguments $Changed = $true } if ($Shortcut.WorkingDirectory -ne $WorkingDirectory) { $Shortcut.WorkingDirectory = $WorkingDirectory $Changed = $true } if ($Shortcut.IconLocation -ne $IconLocation) { $Shortcut.IconLocation = $IconLocation $Changed = $true } if ($Shortcut.Description -ne 'Launch Claude with hproxy.local proxy environment') { $Shortcut.Description = 'Launch Claude with hproxy.local proxy environment' $Changed = $true } if ($Changed -or -not (Test-Path -LiteralPath $ShortcutPath)) { $Shortcut.Save() Write-Host "Claude Proxy shortcut: updated $ShortcutPath" } else { Write-Host 'Claude Proxy shortcut: already up to date.' }