'向指定的文件写字符串,第三个参数指定是否删除原来的内容 Function Z_WriteLog(sFileName, sText) Dim fs, fso, sLog sLog = Now() & ": " & sText set fs = CreateObject("Scripting.FileSystemObject") set fso = fs.OpenTextFile(sFileName, 8, True) '第三个参数表明文件不存在,则新建文件 fso.WriteLine sLog fso.Close set fso = Nothing set fs = Nothing End Function