Introduction to the CreateTextFile method of FSO components

Source: Internet
Author: User

Object. CreateTextFile (filename[, overwrite[, Unicode])

Parameters: Object

Required option. Should be the name of the FileSystemObject or Folder object.


Required option. A string expression that indicates the file you want to create.


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.


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.


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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.