Archive: makensis : cmd for changing default setup path


makensis : cmd for changing default setup path
  I would like to have by makensis a command line available for changing default path of the 'setup.exe' compiled.
For exemple, my project setup.nsi is in folder 'toto' and my setup compiled will be available in the folder 'titi'.

Is there a method for that?

Sincerely,
Yves


Use OutFile from the command line using the /X switch.

makensis /XOutFile titi\setup.exe setup.nsi
You can also define some constants from the command line which can later be processed by the script.
makensis /DSETUP_DIR=titi
!ifdef SETUP_DIR
OutFile "${SETUP_DIR}\setup.exe"
!else
OutFile setup.exe
!endif

That's alright!
Thanks a lot!


hi,

i use a batch file to set

set RepScrFiles=c:\projects\build\app

E:\NSIS\makensis /V4 /XOutFile %RepScrFiles%\Dist\setup.exe %RepScrFiles%\ScriptFiles\setup.nsi

but still have an error :

OutFile expects 1 parameters, got 0.
Usage: OutFile install_output.exe

if i delete /XOutFile ... the setup is created in the %RepScrFiles%\ScriptFiles\ directory

what's wrong ?


Try quotes around the OutFile path.

-Stu


i tried :

E:\NSIS\makensis /V4 /XOutFile "%RepScrFiles%\Dist\setup.exe" %RepScrFiles%\ScriptFiles\setup.nsi

E:\NSIS\makensis /V4 "/XOutFile %RepScrFiles%\Dist\setup.exe" %RepScrFiles%\ScriptFiles\setup.nsi

Added environment variable to NSIS program so in my ScriptFile directory i tried (Dist are directories i created under and above ScriptFiles):

makensis /V4 /XOutFile "Dist\setup.exe" setup.nsi

makensis /V4 /XOutFile "..\Dist\setup.exe" setup.nsi

Each with no success

i'll try kichik's other trick (makensis /DSETUP_DIR=titi) or i'll finally add code in the batch file to move the file to the correct directory ! ^^


You could just set a !define value and use that !define in the OutFile instruction in the script itself.

Also, just in case, you could define a default value if the constant does not already exist...

!ifndef OutFile
!define OutFile "default_name.exe"
!endif

OutFile "${OutFile}"


I'm not sure why it doesn't work on the command line. Do you have another OutFile instruction in your script perhaps?

-Stu

!define value is set by /D in the command line ?

In my script i have already an instruction like :

Outfile setup.exe

Is it possible that there is a conflict with command line ?

EDIT :

Command line :

makensis/V4 /DOutFile="..\\Dist\\setup_myApp.exe" setup.nsi 

>
Script code:

ifndef OutFile

>!define OutFile "setup.exe"
>!endif

>OutFile "${OutFile}"
Now it works as expected, i can now improve my batch file to compile scripts in given path and specific ini files

Thank you Afro UK

I'm pretty sure you can't have two OutFile instructions for the same installer. But that works as well if not better.

-Stu