免互動安裝Microsoft .NET Runtime 6.0、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id Microsoft.DotNet.Runtime.6 -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.DotNet.Runtime.6 -e --silentwinget uninstall --id Microsoft.DotNet.Runtime.6 -e --silent依安裝檔
64位元 · EXE(WiX Burn)
靜默安裝
dotnet-runtime-6.0.36-win-x64.exe /quiet解除安裝
msiexec /x {9D3FC73F-1CF4-412C-A1C9-D2AD28CCBD62} /qn /norestart- MSI產品代碼
- {9d3fc73f-1cf4-412c-a1c9-d2ad28ccbd62}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9d3fc73f-1cf4-412c-a1c9-d2ad28ccbd62}
- DisplayVersion
- 6.0.36.34214
ARM64 · EXE(WiX Burn)
靜默安裝
dotnet-runtime-6.0.36-win-arm64.exe /quiet解除安裝
msiexec /x {17EA21F0-B70D-4CB5-AEB9-4AF10C9D433C} /qn /norestart- MSI產品代碼
- {17ea21f0-b70d-4cb5-aeb9-4af10c9d433c}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{17ea21f0-b70d-4cb5-aeb9-4af10c9d433c}
- DisplayVersion
- 6.0.36.34214
32位元 · EXE(WiX Burn)
靜默安裝
dotnet-runtime-6.0.36-win-x86.exe /quiet解除安裝
msiexec /x {8C97CB9F-5366-4851-942A-4DA7D5980EE8} /qn /norestart- MSI產品代碼
- {8c97cb9f-5366-4851-942a-4da7d5980ee8}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{8c97cb9f-5366-4851-942a-4da7d5980ee8}
- DisplayVersion
- 6.0.36.34214
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-microsoft-net-runtime-6-0.ps1
$url = 'https://builds.dotnet.microsoft.com/dotnet/Runtime/6.0.36/dotnet-runtime-6.0.36-win-x64.exe'
$sha256 = '6BDAD7BC4C41FE93D4AE7B0312B1D017CFE369D28E7E2E421F5B675F9FEEFE84'
$file = Join-Path $env:TEMP 'dotnet-runtime-6.0.36-win-x64.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 '/quiet' -Wait install-microsoft-net-runtime-6-0.ps1
$url = 'https://builds.dotnet.microsoft.com/dotnet/Runtime/6.0.36/dotnet-runtime-6.0.36-win-arm64.exe'
$sha256 = 'E34775FF8723BF4E6D397473E302E246A18692E6EA3B3906EFF3CB5A6F8C8F3B'
$file = Join-Path $env:TEMP 'dotnet-runtime-6.0.36-win-arm64.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 '/quiet' -Wait install-microsoft-net-runtime-6-0.ps1
$url = 'https://builds.dotnet.microsoft.com/dotnet/Runtime/6.0.36/dotnet-runtime-6.0.36-win-x86.exe'
$sha256 = '3B3CB4636251A582158F4B6B340F20B3861E6793EB9A3E64BDA29CBF32DA3604'
$file = Join-Path $env:TEMP 'dotnet-runtime-6.0.36-win-x86.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 '/quiet' -Wait