Read a Text File and print line by line


Option Explicit
Dim gpsFile
Dim gpsFileLines
Dim eGpsLine

Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim oWS : Set oWS = CreateObject("WScript.Shell")
gpsFile = "c:\yourtextfile.txt"

With oFSO.GetFile(gpsFile)
'Get all Lines
gpsFileLines = Split(.OpenAsTextStream(1, 0).Read(.Size), vbcrlf)
End With

For Each eGpsLine in gpsFileLines
'Print all lines on by one
Wscript.Echo eGpsLine & vbcrlf
Next
Wscript.Quit

Leave a Reply

Your email address will not be published. Required fields are marked *