tags:

views:

32

answers:

2

I need a VBS script to output the first line of text along with another line of text for file data.txt.

example of my text.txt file

line1 + line2 to 1.txt line1 + line3 to 2.txt line1 + line4 to 3.txt

Thanks in advance, Best regards, joe

A: 

You can write to files using the FileSystemObject. This page shows some sample code for opening and writing to a file: Working with Files

ho1
+1  A: 

Long time since i used VBS

Set fso = CreateObject("Scripting.FileSystemObject")
set src = fso.OpenTextFile("test.txt",1)
lines = split(src.readall,vbcrlf)

for i = 1 to ubound(lines)
 set dst = fso.CreateTextFile( i & ".txt", true)
 dst.writeline lines(0)
 dst.writeline lines(i)
 dst.close
next
st0le