MicrosoftDocs / WSL

Source code behind the Windows Subsystem for Linux documentation.
https://docs.microsoft.com/windows/wsl
Other
1.9k stars 563 forks source link

Command to install wsl in powershell #1744

Closed grickmarshall closed 1 year ago

grickmarshall commented 1 year ago

Documentation Issue

https://learn.microsoft.com/en-us/windows/wsl/install#manual-installation-steps

Sample Command:

wsl --install

doesn't work in an elevated version of powershell on Windows 10. The following error occurs

PS C:\Windows\system32> wsl --install wsl : The term 'wsl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

Powershell responds with:

Suggestion [3,General]: The command wsl was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\wsl". See "get-help about_Command_Precedence" for more details.

This works:

PS C:\Windows\system32>.\wsl --install

Link to documentation page

https://learn.microsoft.com/en-us/windows/wsl/install#manual-installation-steps

Suggested Improvements

Please change the sample command to

.\wsl --install

Biswa96 commented 1 year ago

Could you provide the Windows 10 version in your system?

grickmarshall commented 1 year ago

Edition Windows 10 Pro Version 22H2 Installed on ‎8/‎31/‎2020 OS build 19045.2728 Experience Windows Feature Experience Pack 120.2212.4190.0

craigloewen-msft commented 1 year ago

This doesn't reproduce on my machine, or others that I have tried. I suspect it might have been an issue on PowerShell on that version. The command wsl --install is correct. Please try on a newer version, and if you still see this issue please file it at github.com/microsoft/wsl .

Thank you!