• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 977
  • Last Modified:

Looking for the best vbscript methode to read two column text file for parameter data from a text file for param value.

Looking for the best vbscript methode to read two column text file for parameter data from a text file for param value. What to create a batch process for a vbscript update script. Script will need to loop each line update until complete. Looking at a two column text file of two column directory locations c:\test\qa1, c:\test\qa2.
0
williamfl
Asked:
williamfl
1 Solution
 
Bill PrewCommented:
Here's a simple example...

' Define I/O constants
Const ForReading = 1
Const ForWriting = 2

' Define constants for file to process, and pattern to match
Const strInFile = "c:\temp\control.csv"

' Open input file for processing
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objInFile = objFSO.OpenTextFile(strInFile, ForReading)

' Read each line and display all matches on that line
Do Until objInFile.AtEndOfStream
   strLine = objInFile.Readline
   arrField = Split(strLine, ",")
   Wscript.Echo "P1=" & arrField(0)
   Wscript.Echo "P2=" & arrField(1)
Loop

' Wrap up
objInFile.Close
Set objInFile = Nothing

Open in new window

~bp
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now