如何在Inno Setup中使用参数运行.exe文件 [英] How run .exe file in Inno Setup with parameters

查看:385
本文介绍了如何在Inno Setup中使用参数运行.exe文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

nameFile.exe -inf fileDriver.inf安装

nameFile.exe -inf fileDriver.inf install

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

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;

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

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

推荐答案

查看您的 Exec 调用,您需要将命令参数传递给函数调用的第二个参数.尝试改用这样的方法:

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);
...

Exec 函数声明为:

The Exec function is declared as:

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

这篇关于如何在Inno Setup中使用参数运行.exe文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆