There are two options. Neither is perfect, and both require
that the program is officially installed. One method,
if you know the executable name, is to look here:
HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths
Under the App Paths key will be a key named for the
EXE (ex.: "program.exe"). The default value in that key
should be the EXE path.
The other method is to check this key:
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
Each subkey here is a name of a program that shows
in the Uninstall window. But this method has even more
problems than the first:
1) The program must have a registered uninstaller. The installer
itself writes this key.
2) You must know the official name of the program.
3) The Windows Installer system messes up the operation
of this key. A program installed via MSI will use a CLSID for
a key name instead of using the program name. That means
that you have to enumerate all the keys if you really want to
use this method because the names of the Uninstall subkeys are
just not very useful. Something like "ABC Editor" *should*
have a key name the same as the program folder, but it might
be "Acme ABC Editor", or it might be "{1A34D....."
4) UninstallString and DisplayName are pretty much the
only values that a program needs to put here in order for
uninstall to work via Add/Remove Programs. And the uninstall
string does not necessarily point to the program folder. It
could point to, say, an uninstall EXE in the Windows folder.
Some programs will add a value like "InstallLocation" to
this key, but it's not necessary. To make things even more
confusing, Microsoft will add invalid entries here. For instance,
when they want to store an uninstall string but block uninstall,
they'll leave out the DisplayName value so that it doesn't
show up in Add/Remove Programs. Or they may list a program
that has no values at all in the key.
Post by A K ArunHi,
How can I get the installed location of a windows software using VBScript ?
Thanks in advance,
Arun