38 lines
1.1 KiB
PowerShell
38 lines
1.1 KiB
PowerShell
# Handy 0.8.3 Windows 安装(x64 / arm64 自动选择)
|
||
$ErrorActionPreference = "Stop"
|
||
$Ver = "0.8.3"
|
||
$Base = "https://github.com/cjpais/Handy/releases/download/v$Ver"
|
||
|
||
$arch = $env:PROCESSOR_ARCHITECTURE
|
||
if ($arch -eq "ARM64") {
|
||
$Asset = "Handy_${Ver}_arm64-setup.exe"
|
||
} else {
|
||
$Asset = "Handy_${Ver}_x64-setup.exe"
|
||
}
|
||
|
||
$Url = "$Base/$Asset"
|
||
$Dest = Join-Path $env:TEMP $Asset
|
||
|
||
Write-Host "下载 $Asset …"
|
||
Invoke-WebRequest -Uri $Url -OutFile $Dest -UseBasicParsing
|
||
|
||
Get-Process -Name "handy","Handy" -ErrorAction SilentlyContinue | Stop-Process -Force
|
||
|
||
Write-Host "安装 Handy(静默)…"
|
||
$proc = Start-Process -FilePath $Dest -ArgumentList "/S" -Wait -PassThru
|
||
if ($proc.ExitCode -ne 0) {
|
||
Write-Warning "静默安装退出码 $($proc.ExitCode),尝试交互安装…"
|
||
Start-Process -FilePath $Dest -Wait
|
||
}
|
||
|
||
Start-Sleep -Seconds 3
|
||
$exe = "${env:ProgramFiles}\Handy\Handy.exe"
|
||
if (-not (Test-Path $exe)) {
|
||
$exe = "${env:LocalAppData}\Programs\Handy\Handy.exe"
|
||
}
|
||
if (Test-Path $exe) {
|
||
Write-Host "✓ 已安装: $exe"
|
||
} else {
|
||
Write-Warning "未在默认路径找到 Handy.exe,请从开始菜单启动 Handy 一次"
|
||
}
|