免互動安裝Lua、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id DEVCOM.Lua -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id DEVCOM.Lua -e --silentwinget uninstall --id DEVCOM.Lua -e --silent依安裝檔
64位元 · MSI
靜默安裝
msiexec /i Lua-5.4.6-win64.msi /qn /norestart寫入記錄檔
msiexec /i Lua-5.4.6-win64.msi /qn /norestart /l*v "%TEMP%\lua-install.log"解除安裝
msiexec /x {9C5329C4-B469-4EB5-9BAE-DE5C3B1B3000} /qn /norestart- MSI產品代碼
- {9C5329C4-B469-4EB5-9BAE-DE5C3B1B3000}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9C5329C4-B469-4EB5-9BAE-DE5C3B1B3000}
- UpgradeCode
- {3E5A792D-9D31-41D5-A93F-629AB7C7683D}
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-lua.ps1
$url = 'https://github.com/DevelopersCommunity/cmake-lua/releases/download/v5.4.6/Lua-5.4.6-win64.msi'
$sha256 = '1087ABB5ACA89CAD29283A17745AC2819AA46CA076084E8B3416DB87D2694ED8'
$file = Join-Path $env:TEMP 'Lua-5.4.6-win64.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