How can I append text to a file?
Asked
Active
Viewed 4,854 times
4
-
Related: [Using Inno Setup scripting to insert lines into a text file?](https://stackoverflow.com/q/73711995/850848) – Martin Prikryl Sep 16 '22 at 10:48
2 Answers
8
You can use the SaveStringToFile()
function to append text to a file.

mghie
- 32,028
- 6
- 87
- 129

Kyle Alons
- 6,955
- 2
- 33
- 28
4
fileName := ExpandConstant('{pf}\{#MyAppName}\batch.bat');
SetArrayLength(lines, 3);
lines[0] := 'echo hello';
lines[1] := 'pause';
lines[2] := 'exit';
Result := SaveStringsToFile(filename,lines,true);

Martin Prikryl
- 188,800
- 56
- 490
- 992

user2754610
- 41
- 1