Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Change the DateLastModified property, or the CreateDate property

254 views
Skip to first unread message

Marc B. Hankin

unread,
Jan 15, 2005, 1:55:33 PM1/15/05
to
I'm trying to create a vbscript that will change
the 'DateLastModified' property.
My script (below) produces the following error message:

Error: Wrong number of arguments or invalid
property assignment: 'DateLastModified'
Code: 800A01C2
Source: Microsoft VBScript runtime error

Here's my script:

Dim filesys, demofile, createdate
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofile = filesys.GetFile("E:\Desktop Pack Scripts\WordTemplate.dot")
createdate = demofile.DateLastModified
wscript.echo createdate
demofile.DateLastModified = "1/13/2005 1:19:00 PM" ' This didn't work.
wscript.echo DateLastModified

I would also like to be able to change the createdate property. Any ideas
would be much appreciated.

Marc


Michael Harris (MVP)

unread,
Jan 15, 2005, 2:05:04 PM1/15/05
to
Marc B. Hankin wrote:
> I'm trying to create a vbscript that will change
> the 'DateLastModified' property.
> My script (below) produces the following error message:
>
> Error: Wrong number of arguments or invalid
> property assignment: 'DateLastModified'
> Code: 800A01C2
> Source: Microsoft VBScript runtime error


Because the date properties are readonly. You need a touch utility. There
are many to found on the web.

Here's just one that I've found (can't vouch for it as I've never used it).

flo's freeware - Misc. Tools
http://www.flos-freeware.ch/misc.html

ntouch
This utility for Windows NT/2k/XP can be used to modify timestamps of files
and directories. You can either run ntouch from the command line and specify
the files to be modified as separate arguments (with wildcards), or you can
add files and directories using drag & drop from Explorer. Holding Shift
adds all the files from a dropped directory, and pressing Ctrl adds the
directory as well as all of its content. Hit Del to remove the selected
files and directories from the list.

>
> Here's my script:
>
> Dim filesys, demofile, createdate
> Set filesys = CreateObject("Scripting.FileSystemObject")
> Set demofile = filesys.GetFile("E:\Desktop Pack
> Scripts\WordTemplate.dot") createdate = demofile.DateLastModified
> wscript.echo createdate
> demofile.DateLastModified = "1/13/2005 1:19:00 PM" ' This didn't
> work. wscript.echo DateLastModified
>
> I would also like to be able to change the createdate property. Any
> ideas would be much appreciated.
>
> Marc

--
Michael Harris
Microsoft MVP Scripting


0 new messages