TextStream
TextStream object helps the developers to work with text
files seamlessly. Developers can read, write or append
the contents to the text file using the text stream object.
Syntax
TextStream.{property | method( )}
Example
If the above script is saved as HTML and executed in IE,
we would create a folder with name "Test_Folder".
<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objTextFile
Set objTextFile = objFSO.CreateTextFile("D:\Testfile.txt")
objTextFile.Close
Const ForAppending = 8
Set objTextFile = objFSO.OpenTextFile("D:\Testfile.txt",ForAppending,True)
objTextFile.WriteLine "Welcome to VBScript Programming"
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
</script>
</body>
</html>
If the above script is saved as HTML and executed in IE,
it will create a text file in D:\ Drive and append the string specified in the WriteLine Method.
Welcome to VBScript Programming