免互動安裝chainhook、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id HiroSystems.Chainhook -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id HiroSystems.Chainhook -e --silentwinget uninstall --id HiroSystems.Chainhook -e --silent依安裝檔
64位元 · MSI · 所有使用者 · en-US
靜默安裝
msiexec /i chainhook-windows-x64.msi /qn /norestart寫入記錄檔
msiexec /i chainhook-windows-x64.msi /qn /norestart /l*v "%TEMP%\chainhook-install.log"解除安裝
msiexec /x {3AC5F503-F43B-4216-B7CB-754A58AA1EF8} /qn /norestart- MSI產品代碼
- {3AC5F503-F43B-4216-B7CB-754A58AA1EF8}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3AC5F503-F43B-4216-B7CB-754A58AA1EF8}
- UpgradeCode
- {E41901A3-0B71-4D86-9175-B12D7C7533BE}
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-chainhook.ps1
$url = 'https://github.com/hirosystems/chainhook/releases/download/v1.8.0/chainhook-windows-x64.msi'
$sha256 = 'FD886F9BFE294F9E375B31A9E858142376176E933E8E5C7CD25294272CEF9F47'
$file = Join-Path $env:TEMP 'chainhook-windows-x64.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