向 TextStream 文件中写入给定的字符串和一个换行符。
object.WriteLine([string])
下面的示例演示了WriteLine 方法的用法:
[JScript] var fso, f; fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.CreateTextFile("c:\\testfile.txt", true);f.WriteLine(
"This is a test.")
; f.Close(); [VBScript] Function WriteLineToFile Const ForReading = 1, ForWriting = 2 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)f.WriteLine
"Hello world!"f.WriteLine
"VBScript is fun!" Set f = fso.OpenTextFile("c:\testfile.txt", ForReading) WriteLineToFile = f.ReadAll End Function