Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write an Entire Array with a Single Write

This may be a very trivial question, but I cannot seem to find the answer on Google.

Is there a way to write an entire array of strings to a file without having to loop through the array in VBScript?

like image 816
user2970916 Avatar asked Dec 07 '25 02:12

user2970916


1 Answers

Option Explicit

Dim aData 
    aData = Array( "a", "b", "c", "d" )

With WScript.CreateObject("Scripting.FileSystemObject").CreateTextFile("file.txt", True)
    .Write Join(aData, vbCrLf)
    .Close
End With
like image 55
MC ND Avatar answered Dec 08 '25 16:12

MC ND



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!