вторник, 18 июня 2013 г.

VBScript log function

Function Log (Msg)
    Dim fso_log, LogFile, LogFilePath
    LogFilePath = "D:\Development\vbs.log" 'Folder should exist
    Set fso_log = CreateObject("Scripting.FileSystemObject")
    Set LogFile = fso_log.OpenTextFile(LogFilePath,8,True) 'OpenTextFile(Filepath,[ ForReading = 1 | ForAppending = 8] , [ Create if not exist = true | false ] )
    LogFile.WriteLine(Msg)
    LogFile.Close
    Set fso_log = nothing
End Function