Just upgraded to wsl2 with debian distribution and I wanted to access my files from windows, after some searching I have stumbeld over the following link:
https://www.howtogeek.com/426749/how-to-access-your-linux-wsl-files-in-windows-10/
I did as requested in this link, logged in as root, entered to the root folder and ran the following command:
explorer.exe .
but the output was "bash: explorer.exe: command not found", it seems like it should work, I have tried it in different locations along with the mounted c drive, the regular user and so on.
My question is, why doesn’t it work and how can i fix it?
with respect,
revolution
2
Answers
wsl.exe --list
from a Powershell/CMD window and get the exact name of the distro\wsl$
in explorer and check if you see your distro name there. If not runwsl --shutdown
, start a distro again and recheckYou can right click and map it as a network drive for easier access too
Following rixtech’s works too if you’re already in that folder in the terminal
Run
and add this to
~/.bash_aliases
> why doesn’t it work
explorer.exe
is not found in the out-of-the-box$PATH
in WSL2 Debian.The article at https://www.howtogeek.com/426749/how-to-access-your-linux-wsl-files-in-windows-10/ illustrates opening the File Explorer using WSL2 Ubuntu.
WSL2 Ubuntu has some magic that appends the current user’s Windows
%PATH%
to the Linux$PATH
but that doesn’t appear to be the case for WSL2 Debian at this time. It seems that many folks prefer to turn that magic off, e.g. How to remove the Win10's PATH from WSL> how can i fix it
Some options
/mnt/c/windows/explorer.exe .
~/.bashrc
file, e.g.,~/.bash_aliases
and create an aliasIf creating an alias, you can alias to whatever you prefer, e.g. explore or explorer.exe. Personally I prefer to alias to start because it matches what you’d type at at CMD or PowerShell prompt, e.g.
start .
opens the current directory in File Explorer.