Search code examples
debianwindows-subsystem-for-linuxmicrosoft-file-explorer

Opening the file explorer from wsl2 debian


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


Solution

    1. Run wsl.exe --list from a Powershell/CMD window and get the exact name of the distro
    2. Go to \\wsl$\ in explorer and check if you see your distro name there. If not run wsl --shutdown, start a distro again and recheck
    3. You'll see all your running distros listed, click to open it's filesystem

    You can right click and map it as a network drive for easier access too

    Example

    Following rixtech's works too if you're already in that folder in the terminal

    Run

    echo 'PATH=$PATH:/mnt/c/windows' >> ~/.bashrc
    

    and add this to ~/.bash_aliases

    alias start='/mnt/c/windows/explorer.exe'