A simple, fast, and robust utility to open files, directories, and URLs from WSL in their default Windows applications.
- Fast & Lightweight: Starts instantly as a compiled native binary with no shell overhead.
- Safe & Robust: Correctly handles complex paths with spaces and special characters. Uses a sanitized command execution method to prevent shell injection vulnerabilities.
- Simple & Focused: Does one thing and does it well. The command-line interface is minimal and intuitive.
- Works Out-of-the-Box: Requires no extra libraries or runtimes to install. It works on any modern WSL2 environment by leveraging its built-in tools.
The recommended way is to download the latest binary from the Releases page.
# Replace vX.Y.Z with the latest version number, for example: v1.0.0
wget https://github.com/jbwfu/wsl-open/releases/download/vX.Y.Z/wsl-open_linux_amd64.tar.gz
tar -xvf wsl-open_linux_amd64.tar.gz
sudo mv wsl-open /usr/local/bin/Other Installation Methods
With go install:
go install github.com/jbwfu/wsl-open@latestFrom Source:
git clone https://github.com/jbwfu/wsl-open.git
cd wsl-open
go build
sudo mv wsl-open /usr/local/bin/Provide a path to a file, a directory, or a URL as an argument.
A Note on WSL1 Support
This tool is fully optimized for WSL2. Due to fundamental differences in filesystem architecture, support for opening files and directories on WSL1 is limited.
- Opening URLs works on both WSL1 and WSL2.
- Opening files/directories on Windows drives (e.g.,
/mnt/c/...) works on both. - Opening files/directories from the native Linux filesystem (e.g.,
~/file.txt) is only reliably supported on WSL2.
There are no plans to add specific workarounds for WSL1. It is highly recommended to use WSL2 for the best experience.
# Open a file in its default Windows application
wsl-open "My Documents/report.docx"
# Open the current directory in Windows File Explorer
wsl-open .
# Open a URL in the default Windows browser
wsl-open https://github.comUse the -x flag to see what command would be executed without running it.
For more details, run wsl-open --help.
For minimal WSL environments that may not include xdg-open,
you can link wsl-open to act as a system-wide default.
This allows tools that call xdg-open (like git browse) to work seamlessly.
First, check if xdg-open is already installed:
command -v xdg-openIf the command above returns no output, you can create a symbolic link:
# This finds where wsl-open is and links it to /usr/local/bin/xdg-open
sudo ln -s "$(command -v wsl-open)" /usr/local/bin/xdg-open- Full
xdg-openintegration. - Native path translation (remove
wslpathdependency).
Contributions are welcome! Please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.