‘Copy C:\Backup.Log.File.txt to desktop and add current date and time to the filename.
‘Robert Holland:20100303:
Const ForWriting = 2
strDate = Replace(Date(), “/” ,”_” )
strDate = Now()
‘Now get the parts of the date I want so I can make my own string.
strYear = DatePart(“yyyy”,strDate)
strMonth = DatePart(“m”,strDate)
strDay = DatePart(“d”,strDate)
strHour = DatePart(“h”,strDate)
strMinute = DatePart(“n”,strDate)
strSecond = DatePart(“s”,strDate)
‘Can’t get the two digit month and day to show up so I put a letter after everything.
‘strFileDate = “Y” & strYear & “M” & strMonth & “D” & strDay & “H” & strHour & “m” & strMinute & “s” & strSecond & “.txt”
strFileDate1 = strYear & “Y” & strMonth & “M” & strDay & “D” & strHour & “H” & strMinute & “m” & strSecond & “s” & “.txt”
‘Set objFSO = CreateObject(“Scripting.FileSystemObject”)
‘Set objOutputFile = objFSO.CreateTextFile( _
‘ “c:\Software\DateInFileName ” _
‘ & strFileDate, ForWriting)
Set objShell = WScript.CreateObject(“WScript.Shell”)
Dim oWshEnvironment, FSO
Set oWshEnvironment = objShell.Environment(“Process”)
Set FSO = CreateObject(“scripting.FileSystemObject”)
sCurrentProfile = oWshEnvironment(“USERPROFILE”)
‘Copy the file and append the date.
‘FSO.CopyFile “C:\Backup.Log.File.txt”, sCurrentProfile & “\Desktop\” & “Backup.Log.File.” & strFileDate
‘FSO.CopyFile “C:\Backup.Log.File.txt”, “C:\Software\BackupLog\” & “Backup.Log.File.” & strFileDate
FSO.CopyFile “C:\Backup.Log.File.txt”, sCurrentProfile & “\Desktop\” & “Backup.Log.File.” & strFileDate1
FSO.CopyFile “C:\Backup.Log.File.txt”, “C:\Software\BackupLog\” & “Backup.Log.File.” & strFileDate1