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
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