Instead of "cmd" write "wsl" in the adress bar.
Second try:
Sorry, I have overseen the last line in the original text, probably because it was after the screenshots.
Please, use the following command on the command line to check if your registry has the following keys:
- WSL-key:
reg query HKCR\Directory\shell\WSL
The content on my computer (unchanged from me) is:
HKEY_CLASSES_ROOT\Directory\shell\WSL
(Default) REG_SZ @wsl.exe,-2
Extended REG_SZ
NoWorkingDirectory REG_SZ
- The starting command:
reg query HKCR\Directory\shell\WSL\command
The content should be:
HKEY_CLASSES_ROOT\Drive\shell\WSL\command
(Default) REG_SZ wsl.exe --cd "%V"
As you can see, here is a "hiden" change-directory-command (cd) and a parameter.
Similarly, query the respective key for drives:
reg query HKCR\Drive\shell\WSL\command
If you get the following error:
ERROR: The system was unable to find the specified registry key or value.
something is wrong with your installation of wsl. Changing the values of the mentioned keys could solve the problem, but is not trivial, because they are protected and only the trusted installer can change them. IMHO it will be easier to deactivate the WSL in the windows features, reboot, activate it again and reboot again.
A workaround (and probably easier solution) can be to define a new key
reg add HKCR\Directory\shell\WSL_here\command /ve /d "wsl.exe --cd \"%V\""
in a command-prompt-window with elevated privilege, of course. This should insert in Windows explorer immediately a new entry in the right-click menu on any directory, which would start a wsl in that directory by selecting/clicking.
wslinto File Exploer does open in the directory that Explorer is viewing for me. Do you perhaps have something in one of your startup scripts (e.g.~/.bashrc) that changes the directory? – NotTheDr01ds Jul 26 '22 at 14:36cmd, thenwslfrom within that CMD session, so that would mean that it couldn't be a startup file that's overriding it. Not sure then ... – NotTheDr01ds Jul 26 '22 at 14:38bashpulls of the same thing for me in addition to WSL. – Señor CMasMas Jul 26 '22 at 15:31cmdthen runningwslorbashI cannot go to that directory. – Name Jul 26 '22 at 15:36wsl -e bash --noprofile --norc, does it then start in the current working directory? If so, then that would be fairly conclusive, I believe, that something in one of your startup files is causing the issue. – NotTheDr01ds Jul 26 '22 at 16:04wsl -e bash --noprofile --norcstarts in the root ofwsl, the directory containingbin boot dev etc home init lib lib32 lib64 libx32 media mnt opt proc root run sbin snap srv sys tmp usr var. – Name Jul 26 '22 at 16:54bashorwsl, it starts in the current directory. – Name Jul 26 '22 at 19:23where wsl(in CMD) andget-command wsl(in PowerShell) point to the same location? – NotTheDr01ds Jul 26 '22 at 21:12doskey /macros(in CMD) doesn't show WSL in there, right? – NotTheDr01ds Jul 26 '22 at 21:13where wslanddoskey /macrosgive no result. – Name Jul 27 '22 at 03:52