JScript Reference (File Merging)
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
var f1 = fso.OpenTextFile( "firstfile.txt", 1 ); // Open for reading
var f2 = fso.OpenTextFile( "secondfile.txt", 1 ); // Open for reading
var f3 = fso.OpenTextFile( "Output.txt", 2, true ); // Open for writing, create
f3.write(f1.ReadAll()); // Write Data from first file to output
f3.write(f2.ReadAll()); // Write Data from second file to output
f1.Close(); f1 = null;
f2.Close(); f2 = null;
f3.Close(); f3 = null;
function appendfile(topfile,bottomfile) {
try {
var fso = new ActiveXObject("Scripting.FileSystemObject")
var ftop = fso.OpenTextFile(topfile,8,false)
var fbot = fso.OpenTextFile(bottomfile,1)
ftop.write(fbot.readall())
}
catch(e) {
WScript.Echo("Error: " + e.description)
}
}
appendfile("first.txt","second.txt");