免互動安裝DTrace、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id Microsoft.DTrace -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.DTrace -e --silentwinget uninstall --id Microsoft.DTrace -e --silent依安裝檔
64位元 · MSI · en-US
靜默安裝
msiexec /i DTrace.amd64.msi /qn /norestart寫入記錄檔
msiexec /i DTrace.amd64.msi /qn /norestart /l*v "%TEMP%\dtrace-install.log"解除安裝
msiexec /x {6403795B-BDDC-42F2-9DEC-A46464475C72} /qn /norestart- MSI產品代碼
- {6403795B-BDDC-42F2-9DEC-A46464475C72}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6403795B-BDDC-42F2-9DEC-A46464475C72}
ARM64 · MSI · en-US
靜默安裝
msiexec /i DTrace.arm64.msi /qn /norestart寫入記錄檔
msiexec /i DTrace.arm64.msi /qn /norestart /l*v "%TEMP%\dtrace-install.log"解除安裝
msiexec /x {6403795B-BDDC-42F2-9DEC-A46464475C72} /qn /norestart- MSI產品代碼
- {6403795B-BDDC-42F2-9DEC-A46464475C72}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6403795B-BDDC-42F2-9DEC-A46464475C72}
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-dtrace.ps1
$url = 'https://download.microsoft.com/download/7/9/d/79d6b79a-5836-4118-a9b7-60bc77c97bf7/DTrace.amd64.msi'
$sha256 = '379FA23FB3D0C079A58D9989FAF4435AE3B9109032B0CF1E84695EAC445E8804'
$file = Join-Path $env:TEMP 'DTrace.amd64.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 install-dtrace.ps1
$url = 'https://download.microsoft.com/download/7/9/d/79d6b79a-5836-4118-a9b7-60bc77c97bf7/DTrace.arm64.msi'
$sha256 = '8FDCC2717B1CF3ACA01D4B59BDD812E6461F92A452253FAD992A1F12C3737DF6'
$file = Join-Path $env:TEMP 'DTrace.arm64.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