免互動安裝Microsoft .NET Runtime 3.1、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id Microsoft.DotNet.Runtime.3_1 -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.DotNet.Runtime.3_1 -e --silentwinget uninstall --id Microsoft.DotNet.Runtime.3_1 -e --silent依安裝檔
64位元 · EXE(WiX Burn)
靜默安裝
dotnet-runtime-3.1.32-win-x64.exe /quiet解除安裝
msiexec /x {784973C8-D618-4AC8-97ED-1FD52C5BDF2F} /qn /norestart- MSI產品代碼
- {784973c8-d618-4ac8-97ed-1fd52c5bdf2f}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{784973c8-d618-4ac8-97ed-1fd52c5bdf2f}
- DisplayVersion
- 3.1.32.31915
ARM64 · EXE(WiX Burn)
靜默安裝
dotnet-runtime-3.1.32-win-arm64.exe /quiet解除安裝
msiexec /x {6CC44C43-4785-4357-A07B-8C9A354692EC} /qn /norestart- MSI產品代碼
- {6cc44c43-4785-4357-a07b-8c9a354692ec}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6cc44c43-4785-4357-a07b-8c9a354692ec}
- DisplayVersion
- 3.1.32.31915
32位元 · EXE(WiX Burn)
靜默安裝
dotnet-runtime-3.1.32-win-x86.exe /quiet解除安裝
msiexec /x {9D5027E4-B04B-4AA9-92FB-1246F97F9CD7} /qn /norestart- MSI產品代碼
- {9d5027e4-b04b-4aa9-92fb-1246f97f9cd7}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{9d5027e4-b04b-4aa9-92fb-1246f97f9cd7}
- DisplayVersion
- 3.1.32.31915
ARM · ZIP
免安裝(可攜版)
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-microsoft-net-runtime-3-1.ps1
$url = 'https://builds.dotnet.microsoft.com/dotnet/Runtime/3.1.32/dotnet-runtime-3.1.32-win-x64.exe'
$sha256 = '4393D2CDACECC096E964EA9761DFD5C336FB002B1B3AE0808E7D2D445E2DEA89'
$file = Join-Path $env:TEMP 'dotnet-runtime-3.1.32-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-3-1.ps1
$url = 'https://builds.dotnet.microsoft.com/dotnet/Runtime/3.1.32/dotnet-runtime-3.1.32-win-arm64.exe'
$sha256 = '44B1DAA5D705411E64F2733000DE2906B4BC655AFF965A5B7E0A0573C7C6ECE2'
$file = Join-Path $env:TEMP 'dotnet-runtime-3.1.32-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-3-1.ps1
$url = 'https://builds.dotnet.microsoft.com/dotnet/Runtime/3.1.32/dotnet-runtime-3.1.32-win-x86.exe'
$sha256 = 'BC735B1A969CD03CBF1D0A70D5F16402E1030F309E5E58CA072307A30F0DF164'
$file = Join-Path $env:TEMP 'dotnet-runtime-3.1.32-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