I'm trying to create a login script that will allow a patch to be installed during login. It starts off...

CLS
?

$Selection = ExistKey ("I enter registry key here")

IF $Selection = 0
? "Key exists. System already updated."
Exit
ELSE
MESSAGEBOX ("Your system will now be updated with the xxx patch.", "Patch Install", 0, 20)
RUN "patch.exe"
ENDIF

SLEEP 15

CLS

; so far it works great up to here

$ReturnCode = ExistKey ("I enter registry key here")

IF $ReturnCode = 0
? "Key has been updated."
EXIT
ELSE
? "Your system has not been updated. It will now logoff."
SLEEP 3
LOGOFF (1)
ENDIF

EXIT


That's it. As previously stated, it runs great up to the second CLS but every single time it runs the commands for the ELSE in the second IF...ELSE statement (even if the patch was loaded). I have been unsuccessful in using the debugger, probably because I'm not using it properly. I've tried to run it with the /d option but nothing. What am I doing wrong, other than not reading enough of Kixtart? I would be GREATLY appreciated if you can pass along the answers or any suggestion/advice. Thank you for the attention.