【问题标题】:My batch launched by Inno Setup installer says "The system cannot find the file specified" while it is right thereInno Setup 安装程序启动的批处理显示“系统找不到指定的文件”,而它就在那里
【发布时间】:2021-01-20 11:18:17
【问题描述】:

在我的 Inno 设置脚本中,我有这一行:

[Files]
Source: C:\CLIENTS\ACSORDER\DeployAcsOrder\installSQL\*; DestDir: "{code:GetDir|0}\installSQL";
       
[Run]
Filename: {code:GetDir|0}\installSQL\installSQL.bat Parameters: {code:GetDir|0}\installSQL; Description: {cm:LaunchProgram,LumisTraiteur}; StatusMsg: Installation SQL serveur...; Flags: runhidden
[Code]
var
  DirPage: TInputDirWizardPage;

function GetDir(Param: String): String;
begin
  Result := DirPage.Values[StrToInt(Param)];
end;

procedure InitializeWizard;
begin
  { create a directory input page }
  DirPage := CreateInputDirPage(
    wpSelectDir, 'Moteur base de données', 'Choisir un emplacement de destination du setupSQL', 'SubCaption', False, '');
  { add directory input page items }
  DirPage.Add('Répertoire installation SQL');
  { assign default directories for the items from the previously stored data; if }
  { there are no data stored from the previous installation, use default folders }
  { of your choice }
  DirPage.Values[0] := GetPreviousData('Répertoire installation SQL', 'C:\');
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
  { store chosen directories for the next run of the setup }
  SetPreviousData(PreviousDataKey, 'Directory1', DirPage.Values[0]);
end;
...

但是当安装完成时,它会弹出一个错误说:

无法执行文件:
C:\folderIchoose\installSQL.bat 参数:C:\folderIchoose\

创建过程失败;代码 2.
系统找不到指定的文件。

当我转到C:\folderIchoose 时,installSQL.bat 就在那里,当我尝试使用 cmd 启动和参数时,它可以工作...为什么会说找不到文件?

我想以我的 bach 所在文件夹的名称作为参数启动我的批处理(不确定...)

谢谢。

【问题讨论】:

    标签: inno-setup


    【解决方案1】:

    Parameters: 之前缺少一个分号。所以它被认为是批处理文件路径的一部分。

    应该是:

    [Run]
    Filename: {code:GetDir|0}\installSQL\installSQL.bat; Parameters: ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-21
      • 1970-01-01
      • 2016-12-19
      • 2021-05-01
      相关资源
      最近更新 更多