Created
November 30, 2012 09:20
-
-
Save tkojitu/4174714 to your computer and use it in GitHub Desktop.
How to append text in VBScript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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