如何在Inno Setup中使用参数运行.exe文件

Wil*_*l86 5 parameters executable exe inno-setup

请尝试在cmd控制台中运行以以下方式运行的.exe文件:

nameFile.exe -inf fileDriver.inf安装

在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;
Run Code Online (Sandbox Code Playgroud)

消息显示参数无效,如何使用参数运行exe文件?

TLa*_*ama 4

查看您的Exec调用,您需要将命令参数传递给函数调用的第二个参数。尝试使用类似这样的东西:

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

Exec函数声明为:

function Exec(const Filename, Params, WorkingDir: String; 
  const ShowCmd: Integer; const Wait: TExecWait; 
  var ResultCode: Integer): Boolean;
Run Code Online (Sandbox Code Playgroud)