Skip to main content

1E 23.11 (SaaS)









Writes text to a file, overwriting any existing contents.


FilePath (string): The full path of the file. If the file already exists its contents will be overwritten. Environment variables in the form %variable% for windows, and $variable for non-windows operating systems will be expanded.

Text (string): The text string to be written.

Backup (bool; optional, default false): Whether or not to backup the file prior to writing. If the file already exists, a copy of the file will be made in the same directory with the .bak suffix. If this backup file already exists, an incrementing number will be added after the extension. If a backup cannot be created, this method will return an error.

Encoding (string, optional, default "UTF8NOBOM"): File content encoding. Valid values are:

  • ANSI

  • UTF8” – UTF8 with a byte order mark.

  • UTF8NOBOM” – UTF8 without a byte order mark.

  • UTF16LE” – UTF16 little endian byte order.

  • UTF16BE” -UTF16 big endian byte order.

Return values

ExpandedFilePath (string): The file path of the written file, with any environment variables expanded.

Success (bool): Whether the method succeeded.

BackupFileName (string): The full path of the backup file created if Backup is true. A NULL is returned if Backup is false.


Create a file queen.txt, or backup and then overwrite an existing queen.txt with the supplied Text contents.

FileContent.WriteText(FilePath : "C:\\temp\\queen.txt", Text : "I want to break free!", Backup : true);
The file contents become:
I want to break free!


  • Windows

  • Linux

  • MacOS