R – Get Application Installation Directory

firefoxinstallationvbscript

I'm using some custom actions to install plugins into Firefox in an Installer project.

Quickest path to ground thus far has been to use VBScript.

Currently, I've been assuming the FireFox installation directory is "%PROGRAMFILES%/Mozilla Firefox". Obviously, this needs to change to cope with people doing non-standard installs.

So, the question is, how can I get an installation path of an application (known by name, GUID, whatever) using VBScript*?

*If its downright impossible, using C# is also acceptable (and seems to be answered in a few places) but that will require I redo some of the installation process currently implemented in VBScript; so its less desirable

Best Answer

There is an Install Directory string in the registry that will tell you where it's installed, however it's located in different places depending upon the version of Firefox is installed and the OS upon which it is installed. It will be in a key that looks like one of these:

Windows XP

HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.5.3 (en-US)\Main
HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.0.11 (en-US)\Main
HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.0.5 (en-US)\Main
...

Windows 7 x64

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\3.5.3 (en-US)\Main
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\3.0.11 (en-US)\Main
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\3.0.5 (en-US)\Main
...
Related Topic