Archive: Check if program is already installed


Check if program is already installed
Hi all,

how do I proof if my Programm is already installed on the PC and make then a messagebox like "The Programm you want to install is already installed. Do you want to uninstall it first? yes no (2 Buttons)"

I hope anyone of you knows the answer to my question.

Thanks a lot,

greetings Paddy


Well how would you know the program is installed?

What does your program add to the system to show that it's installed - e.g. registry entries?

-Stu


The problem is, that the group policies of our company always regenerates the registry and the entries, which my Installation made are not still in the registry.


I see. Where would your program be located. Will any of its files be in a fixed folder / location?

-Stu


You can search computer hard disks for specific file names.
This , this or this links can help you with file searching.


Well, easy and fast does it best.



Function FunctionName
IfFileExists "$INSTDIR\Program.exe" Ask_Question
Goto INSTALL

Ask_Question:
MessageBox MB_YESNO "You seem to have this program \
already installed. Would you like to \
uninstall it first?" \
IDYES UNINSTALL IDNO INSTALL

UNINSTALL:
ExecWait '"$INSTDIR\Uninstaller.exe"'

INSTALL:
FunctionEnd

-MichaelFlya-

2MichaelFlya
How are you detect $INSTDIR?

The problem is, that the group policies of our company always regenerates the registry and the entries, which my Installation made are not still in the registry.

Why look at it that complicated? The user installs
where they do, then the program is told what $INSTDIR
is. It just depends on whether or not you set it after
the directory page or not and if you use a directory
page. Paddy82 knows what files are installed that are
constantly there. This doesn't use reg entry so it
wouldn't get erased like Paddy82 was explaining.

If the installer must detect the install directory before
the directory page then have a note pad or xml installed
and parse it. You can use what you grab and store it as
the $INSTDIR var. This is also file based and will not be
erased like the registry would be when it is regenerated
from their group policy function.

-MichaelFlya-


The program is installed if it appears in the Add/Remove programs list in Control Panel.

If it does not, it is not installed or is not corectly installed.

And if the OP can not use the registry I think he/she can use
$COMMONFILES\${COMPANY}\${PRODUCT}\Install.log (or some other file in that directory) to see if his/her executables are there and where they are. And after any successful install, the installer should output the user-selected (or otherwise the default) path to executables in the Install.log file

Adrian Constantin
Romania


Or maybe

SetShellVarContext all
and then look for and read
$APPDATA\${COMPANY}\${PRODUCT}\Install.log

if the user is on Win2000 or later or otherwise if he/she has SHFolder.dll redistributable (from Microsoft or form IE5) installed in $SYSDIR.

By the way, currently Microsoft suggests not using the registry to store application configuration data because it does not support roaming profiles. Instead some .ini or .xml files in $APPDATA should be used. Can you believe it ?

Adrian Constantin
Romania