免互動安裝Spice、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id ChilliBits.Spice -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id ChilliBits.Spice -e --silentwinget uninstall --id ChilliBits.Spice -e --silent依安裝檔
64位元 · MSI · 所有使用者 · en-US
靜默安裝
msiexec /i spice_x64_setup.msi /qn /norestart寫入記錄檔
msiexec /i spice_x64_setup.msi /qn /norestart /l*v "%TEMP%\spice-install.log"解除安裝
msiexec /x {8A594C11-1C1D-4610-8C0C-4223C134F973} /qn /norestart- MSI產品代碼
- {8A594C11-1C1D-4610-8C0C-4223C134F973}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{8A594C11-1C1D-4610-8C0C-4223C134F973}
- UpgradeCode
- {4A04A982-0FFC-4057-8FD1-507C6153567C}
- 安裝資料夾
- %ProgramFiles(x86)%/Spice
- DisplayVersion
- 0.30.2
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-spice.ps1
$url = 'https://github.com/spicelang/spice/releases/download/0.30.2/spice_x64_setup.msi'
$sha256 = '6C8B19CD0995D0724F25246CBF21D96ED5B5980EF9E37E0898F8B71CC44CB2F0'
$file = Join-Path $env:TEMP 'spice_x64_setup.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