Prev Previous Post   Next Post Next
Old 27th September 2018, 13:33   #1
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
!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.

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


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

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
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

file, for-loop, nsis

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump