簡體   English   中英

如何使用參數在Inno Setup中運行.exe文件

[英]How run .exe file in Inno Setup with parameters

請嘗試運行cmd控制台中運行的.exe文件,方法如下:

nameFile.exe -inf fileDriver.inf install

在Inno Setup中我有以下內容:

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;

消息顯示參數無效,如何用參數運行exe文件?

查看Exec調用,需要將命令參數傳遞給函數調用的第二個參數。 嘗試使用類似的東西:

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

Exec函數聲明為:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM