TechTutorials - Free Computer Tutorials  







VBScript - How to Save a File With Today's Date as the Filename 
 


Added: 12/13/2005, Hits: 1,812, Rating: 0, Comments: 0, Votes: 0
Add To Favorites | Comment on this article
This is a little VBScript that will create a file with the system date as the file name. I am going to use this script to create a logfile each time I run a daily scheduled task.....

Code :

Varnow = now
vardate = Day(varnow) & "-" & Month(varnow) & "-" & Year(varnow) & ".log"

LogPath = ("C:\MY Logs\" & VarDate)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(LogPath)


Enjoy!





Comments (0)

Be the first to comment on this article


Related Items







7 Seconds Resources, Inc.




IT Showcase