MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically.
elyfrank posted a topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)Hi guys, I need some help with this script. This script is working right, it reads all the .txt files in a folder and add content in the first line. I just need to modify it so I can add the content after the 1st line of the text files. Thank you very much file.txt example: line 1 my text goes here line 2 line ... vbs script: Dim FSO, txs, fld, fil, content Set FSO = CreateObject("Scripting.FileSystemObject") Set fld = FSO.GetFolder("C:\test\") For Each fil In fld.Files If Right(fil.Name, 3) = "pat" Then Set txs = fil.OpenAsTextStream(1) ' 1 = for reading content = txs.ReadAll txs.Close Set txs = fil.OpenAsTextStream(2) ' 2 = for writing txs.Write "MyDisclaimer:" & vbCrLf & content txs.Close End If Next