I can run code
to start VSCode from inside WSL2.
How would I start Edge (the current Chromium based one)?
I have tried:
~/Code/company/workshops-website$ cmd.exe /c 'start microsoft-edge:\\wsl$\Ubuntu\home\mike\Code\company\workshops-website\index.html'
'\\wsl$\Ubuntu\home\mike\Code\company\workshops-website'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
It starts Edge but doesn't open index.html
(instead Edge searches for it)
How would I start Edge (the Windows app) from inside WSL2?
I'm comfortable making bash aliases, functions, etc.
$ wslview index.html
Will open the file in your default browser on Windows.
wslview is packaged in wslutilities which comes pre-installed on Ubuntu on WSL and some other WSL distros.
If you wish to use the default Windows browser automatically, e.g. when using 'az login', add these lines to your shell's RC e.g. .bashrc or .zshrc:
export DISPLAY=:0
export BROWSER=/usr/bin/wslview
I think the best way to do this is to use explorer.exe
. You can use explorer.exe
to open anything web related in your default browser.
So edit your .bash_aliases
(or create it) to add this line:
alias browser="explorer.exe"
Then you can open your HTML files in your default browser like this:
$ browser index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With