免互動安裝Harbor、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id IvanCharapanau.Harbor -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id IvanCharapanau.Harbor -e --silentwinget uninstall --id IvanCharapanau.Harbor -e --silent依安裝檔
64位元 · EXE(NSIS) · 僅目前使用者
靜默安裝
Harbor_0.5.20_x64-setup.exe /S自訂安裝資料夾
Harbor_0.5.20_x64-setup.exe /S /D=C:\Apps\harbor- 解除安裝登錄機碼
- HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Harbor
64位元 · MSI · 所有使用者
靜默安裝
msiexec /i Harbor_0.5.20_x64_en-US.msi /qn /norestart寫入記錄檔
msiexec /i Harbor_0.5.20_x64_en-US.msi /qn /norestart /l*v "%TEMP%\harbor-install.log"解除安裝
msiexec /x {217C8AEC-6BD0-48AD-AD6B-7B746B77CAB8} /qn /norestart- MSI產品代碼
- {217C8AEC-6BD0-48AD-AD6B-7B746B77CAB8}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{217C8AEC-6BD0-48AD-AD6B-7B746B77CAB8}
- UpgradeCode
- {8389C8AD-7952-5AB4-B907-63255087F027}
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-harbor.ps1
$url = 'https://github.com/av/harbor/releases/download/v0.5.20/Harbor_0.5.20_x64-setup.exe'
$sha256 = 'C355472B9B063AFF85433C293E902A03962A8C1CCDDBF8CCDEF6579166A4DC58'
$file = Join-Path $env:TEMP 'Harbor_0.5.20_x64-setup.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/S' -Wait install-harbor.ps1
$url = 'https://github.com/av/harbor/releases/download/v0.5.20/Harbor_0.5.20_x64_en-US.msi'
$sha256 = '7532118C4FFDB4FC3183BC98485A2D4A9C05595318744DFFB07DB36A860933E0'
$file = Join-Path $env:TEMP 'Harbor_0.5.20_x64_en-US.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait