Writing a List to a File

InstallShield 2026

Call the ListWriteToFile function to write the contents of a string list to a file. Each element in the list becomes a line in the file.

The example script below reads the Autoexec.bat file into the listFile string list and then writes that string list to a file named Autoexec.bak.

listFile = ListCreate (STRINGLIST);

szPath = "C:\\";

szFileOld = "C:\\Autoexec.bat";

szFileNew = "C:\\Autoexec.bak";

 

if (ListReadFromFile (listFile, szFileOld) < 0) then

   MessageBox ("ListReadFromFile failed.", SEVERE);

endif;

 

ListWriteToFile (listFile, szFileNew);