Read a Text File and print line by line





2
Date Submitted Mon. Jun. 25th, 2007 4:25 AM
Revision 1 of 1
Syntax Master sundaramkumar
Tags wscript
Comments 0 comments
Reads a text file and print the contents 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

 

Comments

There are currently no comments for this snippet.

Voting

Votes Down