Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run exe files in NSIS Script?

Tags:

exe

nsis

In InnoSetup, there is a part called run which will execute the exe, batch file and msi. We can also give command line parameters to this run.

I provide the Innosetup sample:

[Run]
Filename: "{app}\msdirent.exe ";
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\NETCFSetupv2.msi""" ; Check:ShouldInstallComCtlUpdate ;

But in NSISS Script, how to run my exe and also I have to provide command line arguments to the concerned exe?

like image 552
karthik Avatar asked Jan 02 '12 12:01

karthik


People also ask

How do you write a NSIS script?

NSIS Setup You can use the NSIS Menu and under the Compiler section click Compile NSI scripts to start MakeNSISW. The makensisw.exe in the NSIS installation folder is the actual compiler. It has a graphical front end that explains three ways to load scripts, so it's very easy to use.

How do you compile NSIS?

NSIS installers are generated by using the 'MakeNSIS' program to compile a NSIS script (. NSI) into an installer executable. The NSIS development kit installer sets up your computer so that you can compile a . nsi file by simply right-clicking on it in Explorer and selecting 'compile'.


2 Answers

You have 3 NSIS instructions that can start a new process: Exec, ExecWait and ExecShell (Internally the first two use CreateProcess and the last one uses ShellExecute)

In all cases SetOutPath sets the working directory for the child process.

It is important to get the quoting correct since NSIS has 3 quote characters and windows paths with spaces should be quoted with ":

ExecWait '"$instdir\myapp.exe"'
Exec '"$instdir\otherapp.exe" param1 "par am 2" param3'
like image 67
Anders Avatar answered Sep 28 '22 08:09

Anders


Try the following commands

Exec "$APPS\msdirent.exe"

For Command Line Args,

Exec "$APPS\msdirent.exe 1"

For Adding msdirent.exe to the installer,

SetOutPath "$APPS"
File "localpath\msdirent.exe"

Exec "$APPS\msdirent.exe 1"
like image 39
Siva Karuppiah Avatar answered Sep 28 '22 08:09

Siva Karuppiah