插入日期和时间戳,vbs

时间:2009-05-04 09:30:12

标签: vbscript

我想插入执行脚本的时间和日期。到目前为止,我只有执行脚本的人的用户名....

Set FSO = wscript.CreateObject("Scripting.FileSystemObject")
Set NewTextFile = FSO.OpenTextFile("UserInfo.flag",2,true)
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "User Name = " & WshNetwork.UserName
NewTextFile.WriteLine("Site replication was last executed by user:")
NewTextFile.WriteLine(WshNetwork.userName)
NewTextFile.Close
Set NewTextFile = Nothing
Set FSO = Nothing

1 个答案:

答案 0 :(得分:5)

你可能想要Now语句:

NewTextFile.WriteLine(Now)

或者,如果您不想要时间,请使用日期