Skip to content
⌘ NSIS Forum Archive

How can use variable in File /r ?

6 posts

r2du-soft#

How can use variable in File /r ?

hi
i must read i a reg key from registry and user that string address in file /r

ReadRegStr $R2 HKCU "Software\DownloadManager" "AppDataIDMFolder"
;in "AppDataIDMFolder" is "C:\Users\Rose\AppData\Roaming\IDM\"

now when i use $R2 in file /r not work!

File /r "$R2*.*"

I do not want copy $R2 files in temp or other patch and after that use a address in file /r , just i must use from variable,but how must can do this?!
thanks
Anders#
Files are compressed on the machine you generate the installer on, variables are used on the end-users machine so this is not possible...

This has been asked several times before and you can only use defines with the File instruction...
JasonFriday13#
Correct. It's a common mistake that beginners make, which is trying to use run-time variables with compile-time commands. It will never work.
jpderuiter#
You can use the compiletime command !system with reg.exe to get a registryvalue from your build machine.
jpderuiter#
e.g.
!system 'REG.exe QUERY "HKCU\Software\DownloadManager" /v AppDataIDMFolder > APPDATAIDMFOLDER.txt'
!searchparse /file APPDATAIDMFOLDER.txt ` AppDataIDMFolder REG_SZ ` APPDATAIDMFOLDER ``
File /r "${APPDATAIDMFOLDER}*.*"
Please note: I guessed the output of the reg.exe in APPDATAIDMFOLDER.txt, used by the searchparse command, would start with ` AppDataIDMFolder REG_SZ `, but you'll have to check yourself by opening APPDATAIDMFOLDER.txt.
jpderuiter#
To be complete: you can delete the temp file 'APPDATAIDMFOLDER.txt' after the searchparse command:
!delfile "APPDATAIDMFOLDER.txt"