简体   繁体   中英

How run .exe file in Inno Setup with parameters

Please, I try run a .exe file that in cmd console runs in the following manner:

nameFile.exe -inf fileDriver.inf install

In the Inno Setup i have the follow:

var
command: Srtring;

Begin

command := 'nameFile.exe -inf fileDriver.inf install';
command := AddQuotes(command);
Exec(command, '', 'C:\pathOfFileName', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
S:= SysErrorMessage(ResultCode);
MsgBox(S, mbInformation, MB_OK);
end;

The message show that the parameters is invalid, how can run the exe file with the parameters?

Looking at your Exec call, you need to pass the command parameters to the second parameter of the function call. Try to use something like this instead:

...
Exec('nameFile.exe', '-inf fileDriver.inf install', 'C:\pathOfFileName', 
      SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
...

The Exec function is declared as:

function Exec(const Filename, Params, WorkingDir: String; 
  const ShowCmd: Integer; const Wait: TExecWait; 
  var ResultCode: Integer): Boolean;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM