Aussie owned and operated, with 23+ years of industry experience, Gold Coast InfoTech is delighted to support all of your business technology requirements.

Gallery

Contacts

success@goldcoastinfotech.com.au

1800 291 071

Scripts, Commands, Registry

VBSCRIPT to merge multiple text files

Const ForReading = 1

Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objOutputFile = objFSO.CreateTextFile(“output.txt”)

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)

Set FileList = objWMIService.ExecQuery _
(“ASSOCIATORS OF {Win32_Directory.Name=’c:temp’} Where ” _
& “ResultClass = CIM_DataFile”)

For Each objFile In FileList
Set objTextFile = objFSO.OpenTextFile(objFile.Name, ForReading)
strText = objTextFile.ReadAll
objTextFile.Close
objOutputFile.WriteLine strText
Next

objOutputFile.Close

Author

Customer

Leave a comment

Your email address will not be published. Required fields are marked *