Old 15th April 2008, 14:52   #1
Junior Member
Join Date: Apr 2008
Posts: 9
nsis script using dos command line parameters


I've created a script that does what I want for 1 particular project, I now want to reuse the script for another 2 similar packages, rather than having several scripts in my file system I want to use a batch script for each package that calls the nsis script, BUT, allows me to pick up a project specifier from the command line and use it as a variable in the nsis script

e.g. makensis script.nsi project1, or makensis script.nsi project2

so that the nsis script will use the project1 or project2 internally for changing text/installer bitmaps etc.

Can anyone give me any pointers on a way to do this.


JHaigh is offline   Reply With Quote
Old 15th April 2008, 15:00   #2
Junior Member
Join Date: Apr 2008
Location: Florianópolis, SC - Brazil
Posts: 16
Send a message via ICQ to rsvargas
if you use conditional compilation (using !if, by example), you can set variables in the command line using:

makensis script.nsi /DProject=Project1

then inside the script you can test like this


!if ${Project} == "Project1"
... code for Project1

rsvargas is offline   Reply With Quote
Old 15th April 2008, 17:59   #3
[NSIS Dev, Mod]
kichik's Avatar
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Parameters should be other way around. The /D should come first or else it won't be defined in the script.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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