# # File: install.ps1 # Description: PowerShell Profile 安装脚本,支持本地和云端安装 # Created: 2026-01-21 16:00:00 # Updated: 2026-01-21 16:46:00 # # 本地使用: .\install.ps1 # 云端使用: irm https://fx4.cn/initpwsh | iex $profileDir = Split-Path -Parent $PROFILE # 创建 $PROFILE 目录 if (-not (Test-Path $profileDir)) { New-Item -ItemType Directory -Path $profileDir -Force | Out-Null Write-Host "创建目录: $profileDir" -ForegroundColor Green } # 判断是本地还是云端安装 if ($PSScriptRoot) { # 本地安装 $profileContent = Get-Content -Path (Join-Path $PSScriptRoot "profile.ps1") -Raw Set-Content -Path $PROFILE -Value $profileContent -Encoding UTF8 Write-Host "已保存 profile 到: $PROFILE" -ForegroundColor Green $claudeSource = Join-Path $PSScriptRoot "claude.ps1" $claudeDest = Join-Path $profileDir "claude.ps1" Copy-Item -Path $claudeSource -Destination $claudeDest -Force Write-Host "已复制 claude.ps1 到: $claudeDest" -ForegroundColor Green } else { # 云端安装 $baseUrl = "https://gist.asfd.cn/jetsung/pwsh/raw/HEAD" $profileUrl = "$baseUrl/profile.ps1" $profilePath = $PROFILE Invoke-RestMethod -Uri $profileUrl -OutFile $profilePath Write-Host "已保存 profile 到: $profilePath" -ForegroundColor Green $claudeUrl = "$baseUrl/claude.ps1" $claudePath = Join-Path $profileDir "claude.ps1" Invoke-RestMethod -Uri $claudeUrl -OutFile $claudePath Write-Host "已保存 claude.ps1 到: $claudePath" -ForegroundColor Green } Write-Host "安装完成!请重启 PowerShell 以加载新的 profile。" -ForegroundColor Cyan