FileSystemObject 对象

FileSystemObject 对象用于访问服务器上的文件系统。

此对象可以处理文件。还可以使用此对象检索文件系统信息。

以下代码创建一个文本文件 (c:\test.txt),然后将一些文本写入该文件:

Dim fso, tso
Set fso = CreateObject("Scripting.FileSystemObject")
Set tso = fso.CreateTextFile("C:\test.txt", True)   ' Creates a text file (overwrites if exists).
tso.WriteLine("Hello, this is a test file.")        ' Writes text to the file.
tso.Close                                          ' Closes the file.

Set tso = Nothing
Set fso = Nothing