WSL allows you to set the default version used by running wsl --set-default-version x
(where x
is the version to set the default to).
Is there any option to see what the current default version is? wsl --get-default-version
is not recognized.
WSL allows you to set the default version used by running wsl --set-default-version x
(where x
is the version to set the default to).
Is there any option to see what the current default version is? wsl --get-default-version
is not recognized.
The WSL default version is stored in a registry entry.
The key is stored at HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
in an entry named DefaultVersion
. The value can either be 1 or 2.
To read the value in PowerShell, you can use the following:
Get-ItemPropertyValue `
-Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss `
-Name DefaultVersion
Get-ItemPropertyValue : A propriedade DefaultVersion não existe no caminho HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss. No linha:1 caractere:1 + Get-ItemPropertyValue ` -Path HKCU:\SOFTWARE\Microsoft\Windows\Curren ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-ItemPropertyValue], PSArgumentException + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand
Commented
Feb 10, 2022 at 17:09
Run the "wsl --status" command to check
$ wsl --status
Default Version: 2
Windows Subsystem for Linux was last updated on 2023-10-20
WSL automatic updates are on.
Kernel version: 5.10.102.1
WSL allows you to set the default version used by running wsl --set-default-version x (where x is the version to set the default to).
The command wsl --set-default-version 2
only exists if you have Windows 10 version 2004
installed. If you have any other supported version installed, you cannot change the default version, since it doesn't support multiple versions.
Is there any option to see what the current default version is? wsl --get-default-version is not recognized.
You are attempting to run a command that does not exists. Instead, you should be be running, wsl --list --verbose
You can check the WSL version assigned to each of the Linux distributions you have installed by opening the PowerShell command line and entering the command (only available in Windows Build 19041 or higher):
wsl --list --verbose
As of today there is no flag to the command wsl
that shows you which is the default version.
The answer from @Rahmound can help you get a feeling for the versions. Additionally it is true, that v1 is the default until you change it. But anyhow this both does not answer the question at hand and unfortunately it does not help on automation approaches just to mention one example.