To execute the batch file, use Exec
support function.
There should be no quotes in the Filename
parameter of the Exec()
.
procedure DeinitializeSetup();
var
InstallationFolder: string;
ResultCode: Integer;
begin
InstallationFolder := ExpandConstant('{app}');
if Exec(InstallationFolder + '\mysql\db\test.bat',
'"' + InstallationFolder + '"',
'', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
Log('Succeeded running batch file');
end
else
begin
Log('Failed running batch file');
end;
end;
If I install a test.bat
with this contents:
@echo off
echo This is test
echo The provided installation path is %1
echo Without quotes: %~1
echo The current working directory is:
cd
pause
using:
[Files]
Source: "test.bat"; DestDir: "{app}\mysql\db"
I get this at the end of the installation:
