Lucky75
15th December 2009 23:37 UTC
Force uninstall->Reboot->New Install
Hi all,
I have an installer where if I am updating versions, I need to uninstall the old stuff, reboot, and then reinstall the new software, all from the same executable.
Is there an easy way to do this and have it resume?
My other option is to set a registry flag, copy the installer to some temporary directory, and then have it determine that the registry flag was set so I need to skip sections, but I would prefer to not have to do that manually.
Thanks for the help!
redxii
16th December 2009 00:40 UTC
You'd use this key to launch the installer after a reboot:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" "MyInstaller" "$EXEPATH\$EXEFILE"
Lucky75
16th December 2009 04:29 UTC
Yeah, that's not the problem. Is there some way to set where I want to resume in the installer script, or to resume where I left off, or call a function or something? Without just setting it as value in some key in the registry?
jpderuiter
16th December 2009 08:52 UTC
You can add a parameter to the path in this registry entry (like '"$EXEPATH\$EXEFILE" /RESUME=YES'),
and then check on startup of the installer if this parameter is set with GetParameters and GetOptions, and skip the code you want.
Lucky75
16th December 2009 16:52 UTC
Thanks. How would I actually use GetOptions to get the value of the resume parameter in a variable? The help file is rather vague.
jpderuiter
16th December 2009 17:59 UTC
${GetParameters} $R0 ;copy all parameters to $R0
${GetOptions} "$R0" "/RESUME=" $R1 ;copy RESUME value from $R0 to $R1
IfErrors 0 +2
MessageBox MB_OK "RESUME value not set" +2
MessageBox MB_OK "RESUME value set: $R1"