Archive: Pass command line argument to an exe in NSIS in compile time


Pass command line argument to an exe in NSIS in compile time
Hi

My Run.exe takes an argument for it to run. I want the NSIS installer to execute the Run.exe with the argument following it during compilation.

Basically Run.exe takes command line argument to run successfully.

My NSIS Code:
---------------------------------------------

!define AutoRun "Run.exe MyArgumentList"

Function AUTORUN
!execute 'AutoRun'
FunctionEnd

Function .onInit

Call AUTORUN

FunctionEnd
---------------------------------------------
The code runs well if i don't pass MyArgumentList. But it is necessary for me to pass an argument.

Is there any way so that i can pass command line argument to Run.exe so that it can execute while compiling the NSIS script.

Thanks
Shyam Gupta


I think you should try !execute ${AutoRun} , instead. That's how you reference a define.


And use:
!define AutoRun 'Run.exe "MyArgumentList"'


And you don't need to put it in a function! Functions are for run-time.

Stu