Archive: Force uninstall->Reboot->New Install


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!


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"


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?


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.


Thanks. How would I actually use GetOptions to get the value of the resume parameter in a variable? The help file is rather vague.


${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"