Archive: Why doesn't this work?


Why doesn't this work?
Hi...I don't know why doesn't this work:

InstallDirRegKey HKLM "Software\MyCompany\MyKey" "Root path"

Function .onInit

StrCpy $INSTDIR InstallDirRegKey\folder1

FunctionEnd

Section "Copy files" SEC01

SetOutPath $INSTDIR\Components
SetOverwrite on
File "source\${DLLname1}"
File "source\${DLLname2}"

SectionEnd

When I run this install the path is shown as: "InstallDirRegKey\folder1"...i want it to be "C:\rootFolder\folder1", where "C:\rootFolder" is in the registry.
So, can anyone help me? I'm a newbie :)...Thanks.


StrCpy $INSTDIR "$INSTDIR\folder1"


Thanks Takhir but I want to use InstallDirRegKey, not INSTDIR. I want the installer to take the path from regisstry, not to be predefined by me. Can you help me with that?


InstallDirRegKey is Attribute, not a variable.
"This attribute tells the installer to check a string in the registry, and use it for the install dir if that string is valid. If this attribute is present, it will override the InstallDir attribute if the registry key is valid, otherwise it will fall back to the InstallDir default."
So installer reads InstallDirRegKey to $INSTDIR if key is valid or uses InstallDir attribute otherwise.


I have done exactly like you said but it's just showing me : "\folder1".


Before sending first reply I tested attached script on my Win2K server, NSIS 2.04 and I could see correct paths. The question may be when installer checks for InstallDirRegKey in the registry, but this is strange... It looks like your registry node exists and it's value is "" or registry has not this string and InstallDir is not defined.


Thanks man...The problem was that I have entered the path in the registry wrong.Now it works.