View Single Post
Old 27th September 2018, 14:33   #1
franklin91
Junior Member
 
Join Date: Sep 2018
Posts: 2
Pass a variable into File function in for loop cycle

My problem is this: I cannot pass variable inside a for loop, it seems that it does not recognize the variable. It takes the string with the variable, but not the variable value. This is my code
code:
!define FORMAT "XY 2018|XY 2019"

!include "LogicLib.nsh"
!include "Explode.nsh"

# set the name of the installer
Outfile "example.exe"

# create a default section.
Section

${Explode} $0 "|" "${FORMAT}"
${For} $1 1 $0
Pop $2
!define PATH_OK "Z:\XY\Doc\List\*$2*"
File "${PATH_OK}"
${Next}

SectionEnd



When I'm going to compile the nsis file, it returns this error:

code:
File: "Z:\XY\Doc\List\*$2*" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "C:\Users\Francesco\Desktop\example.nsi" on line 19 aborting creation process



I can't understand why... if I try to change the code File "${PATH_OK}" with a messagebox the path results ok. Where am I doing wrong? Many thanks to all!
franklin91 is offline   Reply With Quote