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

Change file modified time from within VBScript?

798 views
Skip to first unread message

Jim Easton

unread,
Sep 25, 2013, 7:16:21 PM9/25/13
to
I have a script written in VBS that changes the date modified of files within a folder. This script uses an external touch.exe utility, but I'd really like to make it self-contained. Is there a system call or something similar that could be used instead? It would need to be compatible with Windows XP and later.

Michael Bednarek

unread,
Sep 26, 2013, 7:43:31 AM9/26/13
to
On Wed, 25 Sep 2013 16:16:21 -0700 (PDT), Jim Easton wrote in
microsoft.public.scripting.vbscript:

(Please insert a carriage return every now and the.)
>I have a script written in VBS that changes the date modified of files within a folder. This script uses an external touch.exe utility, but I'd really like to make it self-contained. Is there a system call or something similar that could be used instead? It would need to be compatible with Windows XP and later.

The first returned result from
<http://lmgtfy.com/?q=vbs+filesystem+change+file+date+modfied> was
<http://technet.microsoft.com/en-us/magazine/2008.03.heyscriptingguy.aspx>
which provided this code:

Set objShell = _
CreateObject("Shell.Application")

Set objFolder = _
objShell.NameSpace("C:\Scripts")
Set colItems = objFolder.Items

For Each objItem In colItems
objItem.ModifyDate = _
"01/01/2008 8:00:00 AM"
Next

--
Michael Bednarek "ONWARD"
0 new messages