Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write in a file

Status
Not open for further replies.

evilkalah

Technical User
Jul 30, 2003
11
BE
which command is there to write and read in a file?
i want to add entry's in the hosts file first look if they are there. i looked on tecknet of microsoft both didn't found a command for it
 
Hello evikalah,

You have to look into FileSystemObject from documentation. It is not a single command, but series of manipulation.

regards - tsuji
 
I use a function to write to a log file, you may be able to use the same solution:


Code:
Function WriteLog(strMessage, oFile)

	strMessage = Date() & " " & Time & " : " & strMessage
	oFile.WriteLine strMessage
	
End Function

The VBS would call the function like:

Code:
Set objLogFolder = objFSO.GetFolder(sLogDir)
Set oLogFile = objFSO.CreateTextFile(sLogDir & "\" & sLogName & ".log", forwriting, False)
    return = WriteLog("*** " & sLogName & " Sarted ***", ologfile)

Hope this helps :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top