vbs读取整个文本文件并输出

Const ForReading = 1

Dim message



Dim fs, ts

set fs = CreateObject("Scripting.FileSystemObject")

set ts = fs.OpenTextFile("1.txt", ForReading)

Do Until ts.AtEndOfStream

    message = ts.ReadLine       '即使是空行,也会被读一次

    if message <> "" Then

        MsgBox message

    End if

Loop

ts.Close

set ts = Nothing

set fs = Nothing



你可能感兴趣的:(文本文件)