Skip to content
⌘ NSIS Forum Archive

File command and variables

3 posts

Jonatas#

File command and variables

I want to define a path for one of my directories in a variable, because I'm going to use it in many places. But I'm not being able to make it work with the File command. Here:

This works:

File /r "..\mydir\*.*"
This doesn't:

StrCpy $MyPath "mydir"
File /r "..\$MyPath\*.*"
What am I missing ?
Anders#
Variables can only be used at run-time, files are added at compile-time, so you need to use a define

!define MyPath "mydir"
File /r "..\${MyPath}\*.*"