由Inno Setup安装程序启动的我的批处理显示“系统找不到指定的文件”

问题描述

在我的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 \

CreateProcess失败;代码2。
系统找不到指定的文件

enter image description here

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

我要使用我的bach文件夹的名称作为参数启动我的批处理(不确定要清除...)

谢谢。

解决方法

您在Parameters:之前缺少分号。因此,它被视为批处理文件路径的一部分。

应该是:

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