Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Delphi
Hello,
Anyone knows how to create and write batch file in inno setup or Edit batch file in inno setup?
Posted 16-Oct-12 21:38pm
Comments
skydger at 17-Oct-12 3:28am
   
If there's no such a plug-in, I suppose it is not possible. Inno Setup is a setup 'compiller', so you have to use third-party editors such Notepad or others to create such files.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello,
 
Actually it is possible if you use the [code] section and write your own code.
 
[Code]
function CreateBatch(): boolean;
var
  fileName : string;
  lines : TArrayOfString;
begin
  Result := true;
  fileName := ExpandConstant('{pf}\{#MyAppName}\batch.bat');
  SetArrayLength(lines, 3);
  lines[0] := 'echo hello';
  lines[1] := 'pause';
  lines[2] := 'exit';
  Result := SaveStringsToFile(filename,lines,true);
  exit;
end;
 
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if  CurStep=ssPostInstall then
    begin
         CreateBatch();
    end
end;
 
Valery.
  Permalink  
Comments
Nirali R shah at 18-Oct-12 6:48am
   
Hi, Thank you very much for the code... now i am running this batch.bat file in [run] section but it is not running.. i dont know where i am wrong.. please help me...Thanks in advance.
Nirali R shah at 18-Oct-12 7:46am
   
solved ... i have called CreateBatch() without any condition.
 
procedure CurStepChanged(CurStep: TSetupStep);
begin
CreateBatch();
end;
valery possoz at 18-Oct-12 9:13am
   
CurStep let's you select at which point you want to perform the operation. CurStep=ssInstall means just before the installation starts,CurStep=ssPostInstall means just after the installation finishes CurStep=ssDone means just before Setup terminates. Anyway happy that you made it work. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 320
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 Sergey Alexandrovich Kryukov 184
0 OriginalGriff 5,415
1 DamithSL 4,422
2 Maciej Los 3,820
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,911


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 17 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100