简体   繁体   English

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

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

Please, I try run a .exe file that in cmd console runs in the following manner: 请尝试运行cmd控制台中运行的.exe文件,方法如下:

nameFile.exe -inf fileDriver.inf install nameFile.exe -inf fileDriver.inf install

In the Inno Setup i have the follow: 在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;

The message show that the parameters is invalid, how can run the exe file with the parameters? 消息显示参数无效,如何用参数运行exe文件?

Looking at your Exec call, you need to pass the command parameters to the second parameter of the function call. 查看Exec调用,需要将命令参数传递给函数调用的第二个参数。 Try to use something like this instead: 尝试使用类似的东西:

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

The Exec function is declared as: 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.

相关问题 如何通过Inno Setup中的“Run - > Parameters”传递参数? - How to pass parameter through “Run-->Parameters” in Inno Setup? 如何使用带空格和引号的参数在 PowerShell 中运行 EXE 文件 - How to run an EXE file in PowerShell with parameters with spaces and quotes 从批处理文件中以静默方式运行带有参数的exe - run exe with parameters silently from batch file 如何创建命令行来运行c#exe文件并为form1中的函数提供一些参数? - How to create a command line to run c# exe file and give some parameters to a function in form1? 如何将带有值的命令行参数传递给 Inno Setup Compiler,以便我可以在我的代码中使用它们? - How can I pass command line parameters with a value to the Inno Setup Compiler, so I can use them in my code? 如何使用vba的shell()运行带参数的.exe? - How do you run a .exe with parameters using vba's shell()? 通过循环从具有文件名参数的批处理文件运行另一个exe文件 - Run another exe file from a batch file with filename parameters through a loop 如何通过文件将参数传递给tortoiseproc.exe? - how to pass parameters to tortoiseproc.exe via file? 在VBScript中使用参数运行exe文件 - Running an exe file with parameters in a VBScript 如何在Java中使用参数运行批处理文件? - How to run batch file with parameters in java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM