This example code shows how you can use VBScript to read and write standard text files. The code below can be used as a basis for reading lines from one file, processing them and then writing them back out to another file.
The example script can be used as a base for processing CSV, HTML and XML files.
To use the example paste the code into a text file and give it a .vbs extension.
Set oReadObj = CreateObject("Scripting.FileSystemObject") Set oWriteObj = CreateObject("Scripting.FileSystemObject") Set oRead = oReadObj.OpenTextFile("input.txt", 1) Set oWrite = oWriteObj.CreateTextFile("output.txt", True) Dim strLine Dim intLineCounter intLineCounter = 0 Do Until oRead.AtEndOfStream strLine = oRead.ReadLine ' Process or modify the strLine variable here ' before it is written to the output file oWrite.WriteLine(strLine) intLineCounter = intLineCounter + 1 Loop oWrite.Close() ' Close output file oRead.Close() ' Close input file msgbox("Script Finished")