Archive: Reading Registry to find Default Install Dir?


Reading Registry to find Default Install Dir?
Hi,

I'm trying to set the default install directory. The example script has:

; The default installation directory
InstallDir $PROGRAMFILES\Example1


So I added this:

Function .onInit
ReadRegStr $1 HKLM "registry\key" "subkey"
FunctionEnd

and then tried to use InstallDir $1 but this doesn't seem to work.

Can someone give me some suggestions?

Thanks.


Use InstallDirRegKey instead. It'll read the registry and only change $INSTDIR if the key exists and contains a valid value.


Originally posted by kichik
Use InstallDirRegKey instead. It'll read the registry and only change $INSTDIR if the key exists and contains a valid value.
Thanks that worked! Wasted so much time looking for how to do this... =(