Anyhow, here's one way to do it in VBscript.
Time to process 1,000 lines on my hardware, down from 19 seconds (batch) to 0.07 seconds.
Time to process 10,000 lines: 0.28 seconds
A win for VBscript, I think.
Dim fso, f1, f2
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const FormatSystemDefault = -2, FormatUnicode = -1, FormatASCII = 0
' Supply the 3 file names as parameters
' E.g. Cscript.exe myscript.vbs "Text file 1.txt" "Text file 2.txt" "Interleaved output.txt"
InputFileName1=wscript.arguments(0)
InputFileName2=wscript.arguments(1)
OutPutFileName=wscript.arguments(2)
Set fso = CreateObject("Scripting.FileSystemObject")
' Read file 1 into array
Set f1 = fso.OpenTextFile(InputFileName1, ForReading)
FileContents1 = f1.ReadAll
FileArray1 = Split(FileContents1,vbcrlf)
' Read file 2 into array
Set f2 = fso.OpenTextFile(InputFileName2, ForReading)
FileContents2 = f2.ReadAll
FileArray2 = Split(FileContents2,vbcrlf)
' Get line counts
LineCount1 = Ubound(FileArray1)
LineCount2 = Ubound(FileArray2)
'Display information
wscript.echo "File 1 name : " & InputFileName1
wscript.echo "File 2 name : " & InputFileName2
wscript.echo "Lines in file 1 : " & LineCount1
wscript.echo "Lines:in file 2 : " & LineCount2
' Check they have same number of lines, if not, quit
If LineCount2 <> LineCount1 Then
wscript.echo
wscript.echo "Line counts not equal"
wscript.echo
Wscript.Quit
End If
' Create file 3 (output file)
Set OutPutFile = fso.CreateTextFile(OutPutFileName, True)
' Read out contents of the 2 arrays, interleaved
For i = 0 to Ubound(FileArray1)-1
OutPutFile.WriteLine ( FileArray1 (i) )
OutPutFile.WriteLine ( FileArray2 (i) )
Next
' Close output file
OutPutFile.Close