Object. CreateTextFile (filename[, overwrite[, Unicode])
Parameters: Object
Required option. Should be the name of the FileSystemObject or Folder object.
FileName
Required option. A string expression that indicates the file you want to create.
Overwrite
Options available. A Boolean value that indicates whether an existing file can be overwritten. True if the file can be overwritten, otherwise false. If omitted, the existing file cannot be overwritten.
Unicode
Options available. A Boolean value that indicates whether the file was created in a Unicode or ASCII file format. True if the file is created as a Unicode file, or False if it is created as an ASCII file. If omitted, an ASCII file is assumed.
Description
The following code shows how to use the CreateTextFile method to create and open a text file.
var fso = new ActiveXObject ("Scripting.FileSystemObject");
var a = fso. CreateTextFile ("C:testfile.txt", true);
A.writeline ("This is a test.");
A.close ();
If the overwrite parameter is false, or if the argument is not supplied, an error is generated for the existing filename.