请尝试运行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文件?
答案 0 :(得分:4)
查看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;