If you need to determine the default browser on a system running Microsoft Windows, you can look in the registry at
HKEY_CLASSES_ROOT\http\shell\open\command
To determine the default browser from the command line, you can use
the command reg query HKEY_CLASSES_ROOT\http\shell\open\command
/ve
.
C:\>reg query HKEY_CLASSES_ROOT\http\shell\open\command /ve HKEY_CLASSES_ROOT\http\shell\open\command (Default) REG_SZ "C:\Program Files\Network\Web\Mozilla Firefox\firefox.exe" -osint -url "%1"
If you just wanted a true or false result for determining whether Firefox
is the default browser, you could pipe the output of the reg query
command to the find command as below. A result of 0 means "false", i.e.,
Firefox is not the default browser and a result of 1 means it is the default
browser.
C:\>reg query HKEY_CLASSES_ROOT\http\shell\open\command /ve | find /c /i "firefox" 1
Reference:
-
How Does Your Browser Know that It’s Not The Default?
Date: March 23, 2007
The New Old Thing | Absurdity in Its Fullest