Skip to content

Instantly share code, notes, and snippets.

@tkojitu
Created November 30, 2012 09:20
Show Gist options
  • Save tkojitu/4174714 to your computer and use it in GitHub Desktop.
Save tkojitu/4174714 to your computer and use it in GitHub Desktop.
How to append text in VBScript.
Sub AppendFile(inFilepath, outFilepath)
On Error Resume Next
ForAppending = 8
Set output = gFileSystem.OpenTextFile(outFilepath, ForAppending, True)
Set input = gFileSystem.OpenTextFile(inFilepath)
Do Until input.AtEndOfStream = true
line = input.ReadLine
output.WriteLine line
Loop
input.Close
output.Close
If Err.Number <> 0 Then
script = WScript.ScriptFullName
message = script & " AppendFile failed"
MsgBox message
WScript.Quit 1
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment