Jump to content

How do i write an if statement for uninstall?


zandztrom
 Share

Recommended Posts

Hi I'm curious about how i should write the code for checking for the unique applicationkey in uninstall, and if it exist remove it by running msiexec /x.

Does someone know how to do this?

I was thinkig something like the simplified example below

(I understand I have to use RegRead() or something but I don't know how to practically do the whole thing)

If exsist

(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E32FC3D8-D106-425E-9F9E-8BE6E2E79AC9})

then

RunWait('msiexec.exe /i "{E32FC3D8-D106-425E-9F9E-8BE6E2E79AC9}" /qb', @SystemDir)

End If

RunWait('msiexec.exe /i "Appl.msi" transforms="appl.mst" /qb', @SystemDir)

And son

Link to comment
Share on other sites

one example would be:

$key = ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E32FC3D8-D106-425E-9F9E-8BE6E2E79AC9}","DisplayName")

If Not @error Then

RunWait('msiexec.exe /i "{E32FC3D8-D106-425E-9F9E-8BE6E2E79AC9}" /qb', @SystemDir)

EndIf

RunWait('msiexec.exe /i "Appl.msi" transforms="appl.mst" /qb', @SystemDir)

or if you prefer you check the length of $key for example

if StringLen($key) > 0 then

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

one example would be:

$key = ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E32FC3D8-D106-425E-9F9E-8BE6E2E79AC9}","DisplayName")

If Not @error Then

RunWait('msiexec.exe /i "{E32FC3D8-D106-425E-9F9E-8BE6E2E79AC9}" /qb', @SystemDir)

EndIf

RunWait('msiexec.exe /i "Appl.msi" transforms="appl.mst" /qb', @SystemDir)

or if you prefer you check the length of $key for example

if StringLen($key) > 0 then

Thank's a lot for the reply, I will try that asap...

Best Regards

/Fred

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...