How to run exe files in NSIS Script?

﹥>﹥吖頭↗ 提交于 2021-02-06 08:49:26

问题


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?


回答1:


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"



回答2:


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'


来源:https://stackoverflow.com/questions/8700556/how-to-run-exe-files-in-nsis-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!