How do I insert a date/timestamp before the contents I'm trying to append to a text file with this simple .vbs?

I'm using this script to add text to a variety of .txt's on the fly:

Const ForAppending = 8

Set objArgs = WScript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists(objArgs(1)) Then
    Set objFile = objFSO.OpenTextFile(objArgs(1), ForAppending)
Else
    Set objFile = objFSO.CreateTextFile(objArgs(1))
End If

objFile.WriteLine objArgs(0)
objFile.Close

So I'm sending text with the program launchy this .vbs (addln.vbs) -

("$$" c:\ideas.txt) is what the argument is if I want to send to ideas.txt for example

All I want to do is make it so I get the date and time right before whatever text I send to this text file. I don't think this would be too complicated... thanks for any pointers!

Answers


I think you should be able to do this -

objFile.WriteLine Date() & " " & Time() & " " & objArgs(0)

Need Your Help

Is there a way to include a fragment identifier when using Asp.Net MVC ActionLink, RedirectToAction, etc.?

asp.net-mvc

I want some links to include a fragment identifier. Like some of the URLs on this site:

wordpress rewrite rule need fix

apache wordpress rewrite

Hello I have this rewrite Rule at my Wordpress

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.