免互動安裝DirectX End-User Runtime Installer、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id Microsoft.DirectX -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.DirectX -e --silentwinget uninstall --id Microsoft.DirectX -e --silent依安裝檔
64位元 · EXE
靜默安裝
dxwebsetup.exe /Q64位元 · MSIX
靜默安裝
Add-AppxPackage -Path UAPSignedBinary_Microsoft.DirectX.x64.appx解除安裝
Get-AppxPackage -Name Microsoft.DirectXRuntime | Remove-AppxPackage32位元 · MSIX
靜默安裝
Add-AppxPackage -Path UAPSignedBinary_Microsoft.DirectX.x86.appx解除安裝
Get-AppxPackage -Name Microsoft.DirectXRuntime | Remove-AppxPackage32位元 · EXE
靜默安裝
dxwebsetup.exe /Q不限架構 · EXE
靜默安裝
dxwebsetup.exe /QPowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-directx-end-user-runtime-installer.ps1
$url = 'https://download.microsoft.com/download/1/7/1/1718ccc4-6315-4d8e-9543-8e28a4e18c4c/dxwebsetup.exe'
$sha256 = '2CF71D098C608C56E07F4655855A886C3102553F648DF88458DF616B26FD612F'
$file = Join-Path $env:TEMP 'dxwebsetup.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 '/Q' -Wait install-directx-end-user-runtime-installer.ps1
$url = 'https://download.microsoft.com/download/c/c/2/cc291a37-2ebd-4ac2-ba5f-4c9124733bf1/UAPSignedBinary_Microsoft.DirectX.x64.appx'
$sha256 = 'A042086B3EB11F354B28D7047CE6B249BC828C0F299A7B5E54A7E0ADB112332B'
$file = Join-Path $env:TEMP 'UAPSignedBinary_Microsoft.DirectX.x64.appx'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file install-directx-end-user-runtime-installer.ps1
$url = 'https://download.microsoft.com/download/c/c/2/cc291a37-2ebd-4ac2-ba5f-4c9124733bf1/UAPSignedBinary_Microsoft.DirectX.x86.appx'
$sha256 = 'B4DB87C59A79E9109C2C8EC5C05855582671DC17D717C897619F786959ECDB5A'
$file = Join-Path $env:TEMP 'UAPSignedBinary_Microsoft.DirectX.x86.appx'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file install-directx-end-user-runtime-installer.ps1
$url = 'https://download.microsoft.com/download/1/7/1/1718ccc4-6315-4d8e-9543-8e28a4e18c4c/dxwebsetup.exe'
$sha256 = '2CF71D098C608C56E07F4655855A886C3102553F648DF88458DF616B26FD612F'
$file = Join-Path $env:TEMP 'dxwebsetup.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 '/Q' -Wait install-directx-end-user-runtime-installer.ps1
$url = 'https://download.microsoft.com/download/1/7/1/1718ccc4-6315-4d8e-9543-8e28a4e18c4c/dxwebsetup.exe'
$sha256 = '2CF71D098C608C56E07F4655855A886C3102553F648DF88458DF616B26FD612F'
$file = Join-Path $env:TEMP 'dxwebsetup.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 '/Q' -Wait