Creating log file VBscript

June 7, 2010 at 03:57:27
Specs: Windows XP
I'm trying to create a log file. So far I managed to create a script that shows all folders in a specific location on the computer and write it to a text file. What I would like it to do is make a log file instead of overwriting the folder data.

This is what I got up to now:

On Error Resume Next
Const ForAppending = 8
Dim strLogStream, strDate
Set objShell = CreateObject("Shell.Application")
Set wshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set logStream = objFSO.createtextfile(logFile , True)
Set objLogFile = objFSO.OpenTextFile(strLogFile, ForAppending, True)
Set objFolder = objFSO.GetFolder("H:\")
Set objnewfile = objFSO.CreateTextFile("H:\", True)
Set strLogFile = ("H:\")
Set objColFolders = objFolder.SubFolders
For Each tfolder In objColFolders
objnewFile.write(" ")
objnewFile.write(" ")
objnewFile.writeLine(" ")

Can someone please show me how to create a log file out of this script?

See More: Creating log file VBscript

Report •

June 7, 2010 at 20:44:01
This script appears . . . confused.

Beside each line, comment on exactly what that line does.

Report •
Related Solutions

Ask Question