PDA

Click to See Complete Forum and Search --> : I need a VBS script for reading a text file


alexdata
May 13th, 2002, 05:10 PM
I need a VBS script (a *.vbs file)
That can read a TXT file in the same folder as the VBSscript is..

But I could not make it work by using things like:

Open "Test.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, s
strFromFile = strFromFile & s & vbCrLf
Loop
Close #1
msgbox strFromFile


So then, What must i use inorder to get a VBS to read a txt file
and read it into a variable, then MSGBOX the variable to the screen.. But its important for it to be put in a variable...
Cause I will use the variable further on, after reading the file into it...

and NO, i dont want to make a EXE file, just a VBS script

JoshT
May 14th, 2002, 10:41 AM
VBScript needs to use an external object, ie, FileSystemObject, to read files (or to do almost anything useful, for that matter).