Windows – Path variable for default browser in Windows

browserpathwindows

Some files or folders in Windows have path variables (like %appdata%, %systemroot%, %userprofile%, etc). Is there anything similar to get the default browser?

For example, it could take the value C:\Program Files\Google\Chrome\Application\chrome.exe if Google Chrome is the default browser, C:\Program Files\Mozilla Firefox\firefox.exe if Firefox is the default browser, C:\Program Files\Internet Explorer\iexplore.exe if Internet Explorer is the default browser, etc and always have the same name no matter what.

Best Answer

You can use:

reg QUERY HKEY_CLASSES_ROOT\htmlfile\shell\open\command /ve

And you will get something like:

(Default)    REG_SZ    "C:\Program Files (x86)\Internet Explorer\iexplore.exe"

Then you can easily parse it.

Related Question