Skip to content
⌘ NSIS Forum Archive

give a variable to script and build it automaticly

15 posts

ssam#

give a variable to script and build it automaticly

i copy my files every night to a specific folder and than i want to build the installer. filenames and directory names and filestructure are the same.

now i want to give the installerscript the specific path where my files are and then i want to start the script to build the installer.

how i can give the path to the script to use them?
pospec#
Try this:

!define MY_PATH "C:\My Path"
...
File ${MY_PATH}\*.*

(Still not interested in my replies? 😉)
Afrow UK#
Make sure ${MY_PATH}\*.* is in quotes or you will get a compile error (assuming the path contains spaces).

Stu
ssam#
automatic.bat

Java My_copytool.jar "Path where my Files be copied"
NSIS installer.nsi "Path where my Files be copied"
installer.nsi

!define MY_PATH "here i want to use 'Path where my Files be copied'"

i dont want to change my installer.nsi, if i change the path, where my files are.
pospec#
You don't need to change your script, use parameter /D when calling makensis command. Reading documentation is a good idea before posting here on forum - http://nsis.sourceforge.net/Docs/Chapter3.html#3.1
ssam#
so is this correct?


Java My_copytool.jar "c:\example\copy"
makensis.exe /D !define MY_PATH "c:\example\copy" myscript.nsi
myscript.nsi

SetOutPath '$INSTDIR$\bin'
File '${MY_PATH}\bin\test.cfg'
ssam#
makensis.exe /DUSE_UPX /DVERSION=1.337 /DNO_IMAGES myscript.nsi

this is the example

but what means this?

1 !define USE_UPX VERSION=1.337 NO_IMAGES

or

2 !define USE_UPX
!define VERSION=1.337
!define NO_IMAGES
pospec#
1. It produces compiler error, it is wrong.
2. These three lines are equivalent to your (correct) makensis syntax on first line of your last post.
ssam#
so is this correct?


Java My_copytool.jar "c:\example\copy"
makensis.exe /DMY_PATH "c:\example\copy" myscript.nsi
myscript.nsi

SetOutPath '$INSTDIR$\bin'
File '${MY_PATH}\bin\test.cfg'
LoRd_MuldeR#
I think if your path contains spaces, you must do it like this:

makensis.exe /DMYVAR="C:\Some Folder\Some File.foo" Installer.nsi
However when passing arguments to the installer itself, you must do it like this:

Installer.exe "/MYARG=C:\Some Folder\Some File.foo"