VBScript – How to read .txt file for input

Send Us a Sign! (Contact Us!)
--> (Word) --> (PDF) --> (Epub) --> (Text)
--> (XML) --> (OpenOffice) --> (XPS) --> (MHT)

SCENARIO (Typical)

I'm having a bit of an issue, I have a text file with computer names in it and I am trying to read in each line and then perform a ping...

SOLUTION

Option Explicit
 Dim oFSO, sFile, oFile, sText
 Set oFSO = CreateObject("Scripting.FileSystemObject")
 sFile = "your text file"
 If oFSO.FileExists(sFile) Then
  Set oFile = oFSO.OpenTextFile(sFile, 1)
   Do While Not oFile.AtEndOfStream
    sText = oFile.ReadLine
     If Trim(sText) <> "" Then
      WScript.Echo sText
     End If
   Loop
  oFile.Close
 Else
  WScript.Echo "The file was not there."
 End If

SOURCE

LINK

LANGUAGE
ENGLISH