Ordres per instal·lar Windows Subsystem for Linux sense preguntes, desinstal·lar-lo i detectar-lo des d’eines de desplegament. Només es mostra una ordre quan és segura: la que indica el manifest o el valor per defecte documentat de la tecnologia de l’instal·lador.
Guia relacionada: Instal·lació silenciosa: MSI, NSIS, Inno Setup · Desinstal·lar un programa amb el registre o PowerShell
Amb winget
winget install --id Microsoft.WSL -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.WSL -e --silentwinget uninstall --id Microsoft.WSL -e --silentPer instal·lador
64 bits · MSIX
Add-AppxPackage -Path Microsoft.WSL_2.7.14.0_x64_ARM64.msixbundleGet-AppxPackage -Name MicrosoftCorporationII.WindowsSubsystemForLinux | Remove-AppxPackage64 bits · MSI
msiexec /i wsl.2.7.14.0.x64.msi /qn /norestartmsiexec /i wsl.2.7.14.0.x64.msi /qn /norestart /l*v "%TEMP%\windows-subsystem-for-linux-install.log"msiexec /x {DC52CEBE-E53A-463D-98EE-81AF640914BD} /qn /norestart- Codi de producte MSI
- {DC52CEBE-E53A-463D-98EE-81AF640914BD}
- Clau de desinstal·lació al registre
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DC52CEBE-E53A-463D-98EE-81AF640914BD}
ARM64 · MSIX
Add-AppxPackage -Path Microsoft.WSL_2.7.14.0_x64_ARM64.msixbundleGet-AppxPackage -Name MicrosoftCorporationII.WindowsSubsystemForLinux | Remove-AppxPackageARM64 · MSI
msiexec /i wsl.2.7.14.0.arm64.msi /qn /norestartmsiexec /i wsl.2.7.14.0.arm64.msi /qn /norestart /l*v "%TEMP%\windows-subsystem-for-linux-install.log"msiexec /x {D121F6A7-AEC9-46A4-94CB-0AF3FF1B5B61} /qn /norestart- Codi de producte MSI
- {D121F6A7-AEC9-46A4-94CB-0AF3FF1B5B61}
- Clau de desinstal·lació al registre
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D121F6A7-AEC9-46A4-94CB-0AF3FF1B5B61}
PowerShell: baixar, verificar, instal·lar
Baixa el fitxer oficial, en comprova l’SHA256 i l’instal·la en mode silenciós.
$url = 'https://github.com/microsoft/WSL/releases/download/2.7.14/Microsoft.WSL_2.7.14.0_x64_ARM64.msixbundle'
$sha256 = '7BA80E0846C4E82AC3D33165C21A52D95278BAB422EF005461B5E6ACC37CE66B'
$file = Join-Path $env:TEMP 'Microsoft.WSL_2.7.14.0_x64_ARM64.msixbundle'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file $url = 'https://github.com/microsoft/WSL/releases/download/2.7.14/wsl.2.7.14.0.x64.msi'
$sha256 = 'DB084E536279A59E90A26EC598D8AA8A4DFF8309F41D078FD06242953AC1EBCD'
$file = Join-Path $env:TEMP 'wsl.2.7.14.0.x64.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 $url = 'https://github.com/microsoft/WSL/releases/download/2.7.14/Microsoft.WSL_2.7.14.0_x64_ARM64.msixbundle'
$sha256 = '7BA80E0846C4E82AC3D33165C21A52D95278BAB422EF005461B5E6ACC37CE66B'
$file = Join-Path $env:TEMP 'Microsoft.WSL_2.7.14.0_x64_ARM64.msixbundle'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file $url = 'https://github.com/microsoft/WSL/releases/download/2.7.14/wsl.2.7.14.0.arm64.msi'
$sha256 = '3456D37B2F009FB075A1E35366E8B46CE13A7F8355DF63E278D68FCE319C790A'
$file = Join-Path $env:TEMP 'wsl.2.7.14.0.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