Opening links from WSL Ubuntu in Windows' Chrome
23 Mar 2018 - Aaron Dodd
Aside from Chrome, MS Office, and some work chat apps, most of my time is spent in WSL (using VcXsrv for X11 with WGL enabled).
One thing I was missing was how to open links in the Windows’ version of Chrome (I’ve yet to get sound working in WSL…).
For most cases, exporting BROWSER to the /mnt/c path of Google Chrome is sufficient, but I also use Markdown heavily in Vim and have a macro to generate HTML from it.
Below is a script to map the WSL paths to Windows, and to adjust some of my known DrvFS mounts to proper Windows mounts. If I’m browsing a path local to WSL, it instead opens my WSL version of Chrome.
I find it best to open a command prompt and type “dir /x c:" to get the 8.3 short-name of “C:\Program Files (x86)” since WSL seems to choke on spaces in paths.
I then renamed /usr/local/google-chrome to /usr/local/google-chrome_main and symlink’d /usr/local/google-chrome to this:
For general Bash usage, my .bashrc has: export BROWSER=”/mnt/c/PROGRA~2/Google/Chrome/Application/chrome.exe”