How to open windows explorer from current working directory of WSL shell?
To open the current directory in Explorer - use the following (WSL sets the Windows path by itself):
explorer.exe .
You can set alias with .bashrc
for a custom command:
echo 'alias explorer="explorer.exe ."' >> ~/.bashrc
source ~/.bashrc
Now just use:
explorer
to open the current working directory in Windows Explorer.
Microsoft provides a binary wslpath
for exactly this purpose.
explorer.exe `wslpath -w "$PWD"`
Cribbing from the github issue asking for usage info, there are 4 options - -a
, -u
, -w
and -m
.
wslpath usage:
-a force result to absolute path format
-u translate from a Windows path to a WSL path (default)
-w translate from a WSL path to a Windows path
-m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\\’
EX: wslpath ‘c:\users’
For WSL2 you can access to home directory from windows like this :
\\wsl$
Sorry to be late at the party!