I am starting the process to try and get my machine to run WSL 2, and I began by following the first step of a tutorial by Microsoft that asks you to run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
This produced the following error:
dism.exe : The term 'dism.exe' 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
+ dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsy ...
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (dism.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
This sort of problem is not new to me, a week ago I was trying to run ssh and I got the same error in relation to that, in fact it seems like anything other than the basic cd or ls commands results in the same error. Why doesn't my power shell recognize anything?
I am running Windows 10 Home, I have tried running as administrator and not. I have tried running in basic command line and in windows power shell. What should I do next?
Edit: ran path command reccomended by comments and got this result
C:\Users\Nathaniel>echo [%path:;=]&echo.[%]
[C:\Program Files (x86)\Razer Chroma SDK\bin]
[C:\Program Files\Razer Chroma SDK\bin]
[C:\Program Files (x86)\Razer\ChromaBroadcast\bin]
[C:\Program Files\Razer\ChromaBroadcast\bin]
[C:\Program Files (x86)\Common Files\Oracle\Java\javapath]
[C:\Program Files\Java\jre1.8.0_181\bin]
[C:\Program Files\Git\cmd]
[D:\Prolog\swipl\bin]
[C:\ProgramData\chocolatey\bin]
[C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps]
[D:\Putty\]
[C:\Users\Nathaniel\AppData\Local\Microsoft\WindowsApps]
[C:\Users\Nathaniel\AppData\Local\GitHubDesktop\bin]
[C:\Users\Nathaniel\AppData\Local\Microsoft\WindowsApps]
[D:\Visual Studio Code\Microsoft VS Code\bin]
[D:\Anaconda]
[]
[D:\docker toolbox\Docker Toolbox]
I had the same issue until I added the Windows system32 path into the system environment. It works normally.
Follow these steps: 1- Right-click on "This PC" or "My Computer". 2- Click on "Advanced system settings". 3- Then, Click on "Environment variables".