skip to Main Content

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


    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'
    
    Login or Signup to reply.
  1. > 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

    • Specify the full path at the command line, e.g., /mnt/c/windows/explorer.exe .
    • Append to the path for the current session
    PATH=$PATH:/mnt/c/windows
    
    • Append to the path for future sessions by adding to your ~/.bashrc file, e.g.,
    echo 'PATH=$PATH:/mnt/c/windows' >> ~/.bashrc
    
    • Edit ~/.bash_aliases and create an alias
    alias start='/mnt/c/windows/explorer.exe'
    

    If 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search