I’m a heavy user of the Windows Subsystem for Linux (WSL) and I’d like to share a useful snippet I use.

Many times I’ll want to open the native Windows Explorer from my current directory. Thankfully you can call Windows executables directly from the WSL. The executable is called explorer.exe. It’s first argument can be the location that you want the window to start in.

The only tricky thing here is that you can’t execute something like

explorer.exe "$(pwd)"  since the expanded path is going to be in Linux form, not Windows. The directory separators are going to be forward slashes, and the root of the path is going to look something like /mnt/c/Users/username/.... Fortunately, this is where the command wslpath comes in! It’s a wonderful utility to help convert the Linux paths to Windows paths. So what I have in my .bashrc is eh() { explorer.exe "$(wslpath -w "\$(pwd)")"
}


where eh is short for ‘explore here’. The -w option tells wslpath to convert the path from a WSL path to a Windows path. So in summary, you can use Windows programs in the WSL, and wslpath can help you bridge the differences between the two systems.