Announcing: wsl_open_browser - Inside WSL2 opens a html file in the browser that is in Win10

This is useful in Rust for the documentation: cargo doc --open.
or for simply open a file in a browser from bash: www ./index.html

Try it

Install it from and add 2 symbolic links and one env variable:

cargo install wsl_open_browser
sudo ln -sf "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" /usr/bin/browser_in_win
export BROWSER='/usr/bin/wsl_open_browser'
# I like to use the short command `www` to open a browser
ln -sf "/usr/bin/wsl_open_browser" www

# go to a directory that contains a subdirectory with index.html
cd ~/rustprojects/wsl_open_browser
www docs/index.html
# or
www docs
# or go inside the directory that contains index.html
cd docs
www .
# or simply
# if you want to open an URL

Congratulations! You have just opened a windows browser from WSL2.

This crate does not read or write any files. And does not use any network communication. It is safe. It is just 45 lines of rust code.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.