We currently have a script that runs at startup written in .vbs that
works perfect, it uses something similar to the following. where if
the date is more than 12 months old it runs.
dim startdate
dim duration
startdate = #11/01/2004#
duration = 12
if dateadd("m",duration,startdate) < date() then
where after then it runs the script perfectly.. at the end of the
script we have it run another .vbs which has something similar to the
following
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("backup.vbs", ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "startdate = #11/01/2004#", "startdate =
#11/01/2005#")
Set objFile = objFSO.OpenTextFile("backup.vbs", ForWriting)
objFile.WriteLine strNewText
objFile.Close
And again this works great!, but what I am wondering, to basically make
it seamless, is if there is a way to replace
strNewText = Replace(strText, "startdate = #11/01/2004#", "startdate =
#11/01/2005#")
with something like
strNewText = Replace(strText, "startdate = #11/01/2004#", "startdate =
current date variable")
so I wouldn't have to manually change the file once a year, and worry
about a silly mistake.
I have tried toying around with the %date% variable, but it seems to
write in mm-dd-yy, which I am not sure if the script can understand
with the previous mm/dd/yyyy format.. Does anyone have a suggestion as
to how I might be able to write the current date format in the 2nd part
as mm/dd/yyyy using a variable of sorts?
Matthew Rice
Rice Computer Solutions
www.ricecs.com