将指定数量的换行符写入到一个 TextStream 文件。
object.WriteBlankLines(lines)
下面的示例演示了WriteBlankLines 方法的用法:
[JScript] function WriteBlanksDemo() { var fso, f, r; var ForReading = 1, ForWriting = 2; fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true); f.Write("Hello world!"); f.WriteBlankLines(2); f.Write("JScript is fun!"); f.Close(); f = fso.OpenTextFile("c:\\testfile.txt", ForReading); r = f.ReadAll(); return(r); } [VBScript] Function WriteBlankLinesToFile Const ForReading = 1, ForWriting = 2 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True) f.WriteBlankLines 2 f.WriteLine "Hello World!" Set f = fso.OpenTextFile("c:\testfile.txt", ForReading) WriteBlankLinesToFile = f.ReadAll End Function