WSL: "explorer.exe: command not found" when user changed
-
Windows 10.0.19536.1000
-
What you’re doing and what’s happening:
Login as normal user.
Change user to root
Then try explorer.exe .
- What’s wrong / what should be happening instead:
expected opening of Explorer in Windows but explorer.exe: command not found

About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (1 by maintainers)
No , it did not work for me
(/mnt/c/Windows/explorer.exe .) use this instead of just (explorer.exe .)
I ran into the same problem. when I first startup Ubuntu-18.04 in WSL and echo
PATH, System32 was included, these commands such asexplorer.exe .can ran normally. But if I switch user to root, that problem just came up, echoPATHshows no System32alias explorer.exe='/mnt/c/Windows/explorer.exe echo ‘PATH=$PATH:/mnt/c/windows’ >> ~/.bashrc
These two commands worked for me, thank you so much!
Because the the path
/mnt/c/Windows/explorer.exeisn’t being associated withexplorer.exe. One fix, as mentioned, is to just add it as an alias:alias explorer.exe='/mnt/c/Windows/explorer.exe.It doesn’t worked for me, but I tried to set the user in the command line that launch the distro:
ubuntu2004.exe -u <username>orwsl ~ -d Ubuntu-20.04 -u <username>explorer.exe .works. (worked for me)As a temporary workaround, by changing the default user for wsl allows you to see the user files in windows. open PowerShell in Admin mode
ubuntu2004.exe config --default-user <username>Run
echo $PATH. It should contain/mnt/c/Windows/system32. Did you add any config in/etc/wsl.conf?thanks to your method,I can use explorer.exe again.but I still want to know the reason behind it.
That’s by design Linux. If you
sudo suyou get root’s path, not you roro path.