#define Components
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
#ifdef Components
[Types]
Name: full; Description: Full installation; Flags: iscustom
[Components]
Name: comp; Description: Дополнительные задачи с реестром Батником файлом; Types: full;
Name: comp\reg; Description: Добавить файл реестра; Types: full
Name: comp\bat; Description: Запустить батник после установки; Types: full
Name: Icon; Description: Дополнительные задачи:;
Name: Icon\DesktopIcon1; Description: Создать ярлык на Рабочем столе32; Types: full
Name: Icon\DesktopIcon2; Description: Создать ярлык на Рабочем столе64; Types: full
#endif
[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
Name: "{group}\{cm:UninstallProgram,My Program}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\My Program 32"; Filename: "{app}\32.exe"; Components: Icon\DesktopIcon1;
Name: "{commondesktop}\My Program 64"; Filename: "{app}\64.exe"; Components: Icon\DesktopIcon2;
[Files]
Source: secu.eg.reg; DestDir: {tmp};
;Source: run.bat; DestDir: {tmp};
Source: "1.bat"; DestDir: {app};
Source: "32.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "64.exe"; DestDir: "{app}"; Flags: ignoreversion
Код:
var
ResultCode: Integer;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
if IsComponentSelected('comp\reg') then
begin
ExtractTemporaryFile('secu.eg.reg');
Exec(ExpandConstant('{win}\regedit.exe'), ExpandConstant('/S "{tmp}\secu.eg.reg"'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
if IsComponentSelected('comp\bat') then
begin
ExtractTemporaryFile('1.bat');
//Exec(ExpandConstant('{tmp}\run.bat'), '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
Exec(ExpandConstant('{app}\1.Bat'),'',ExpandConstant('{app}'), SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
end;
[/SPOILER]