Hi how can I use a Registry key as an install path
I don't mean by using
InstallDirRegKey HKLM "Software\NSIS" ""
I already have an install path set
I mean by using
ReadRegStr $0 HKLM "Software\NSIS" ""
You get the path with this
ReadRegStr $0 HKLM "Software\NSIS" ""
MessageBox MB_OK "$0"
"C:\Program Files (x86)\NSIS"
But how can I use the $0 as the install path to install a file?
Say something like this
CopyFiles "$0Fred.txt" "$INSTDIR\Fred"
So from the registry it gets the install path, say something like C:\Harry\Fred.txt and copies it to say C:\Program Files (x86)\NSIS\Fred
Thanks
Oh I've tried GetDrives, couldn't get that to work
An example would be greatly appreciated as would any help
Registry Key to install path
5 posts
You say you want to install a file but you are using CopyFiles in your example. Do you want to copy a file that is already on the end-users system or do you want to extract a file from the installer?
To extract use:
To extract use:
SetOutPath $0
File "c:\source\thefile.txt"
Yes I want to copy it from one dir to another, but I would like to use the registry "install path" instead of like C:\blah it because the Directory I'm copying from is variable, so using the registry install path it will be the correct path each time.
but I need to know how to read the registry path and implement it like this
ReadRegStr $0 HKLM "Software\NSIS" ""
CopyFiles "$0Fred.txt" "$INSTDIR\Fred"
but I'm not sure how to do this, the above code doesn't work and is just an example of what I'm sort of after
What's confusing me is, what all the $0, $1, $2, $R0 and so on mean
I wish you could just use a define like this,
!define NEWPATH HKLM "Software\NSIS" ""
but obviously you can't (I dont think)
CopyFiles "${NEWPATH}Fred.txt" "$INSTDIR\Fred"
but I need to know how to read the registry path and implement it like this
ReadRegStr $0 HKLM "Software\NSIS" ""
CopyFiles "$0Fred.txt" "$INSTDIR\Fred"
but I'm not sure how to do this, the above code doesn't work and is just an example of what I'm sort of after
What's confusing me is, what all the $0, $1, $2, $R0 and so on mean
I wish you could just use a define like this,
!define NEWPATH HKLM "Software\NSIS" ""
but obviously you can't (I dont think)
CopyFiles "${NEWPATH}Fred.txt" "$INSTDIR\Fred"
CopyFiles "$0\Fred.txt" "$INSTDIR\Fred"
Thanks I've just figured it out myself lol
And your answer is correct, I just forgot the backstroke, I've spent most of the afternoon pulling my hair out over a stupid \
I know it should have worked but I could see it until now
Thanks again for the help, it sometimes takes another set of eyes to see the problem lol
And your answer is correct, I just forgot the backstroke, I've spent most of the afternoon pulling my hair out over a stupid \
I know it should have worked but I could see it until now
Thanks again for the help, it sometimes takes another set of eyes to see the problem lol