【问题标题】:How run .exe file in Inno Setup with parameters如何在 Inno Setup 中使用参数运行 .exe 文件
【发布时间】:2013-01-26 23:22:27
【问题描述】:

请,我尝试运行一个 .exe 文件,该文件在 cmd 控制台中以以下方式运行:

nameFile.exe -inf fileDriver.inf install

在 Inno 设置中,我有以下内容:

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文件?

【问题讨论】:

    标签: parameters executable exe inno-setup


    【解决方案1】:

    查看您的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;
    

    【讨论】:

    • 该死!用大约 10 次击键和鼠标点击打败我! :-) +1
    • 我必须对我所写的至少部分内容做某事。 ;-) 不客气。
    • 谢谢,但我把'-inf fileDriver.inf install' 和工作... =)
    • 感谢您的指正!我很久以前就使用过Exec,并从头顶写了这个。
    猜你喜欢
    • 2011-03-30
    • 1970-01-01
    • 2012-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多