View Single Post
Old 08-29-2007   #2 (permalink)
A. Petitjean


 
 

RE: Need help with .CreationTime

Hello BatchMan ;-)

I have tested your script and it seems there's a cache somewhere. In fact my
tests seems to reveal that the creationtime is not refreshed in real time.

When I do that 10 times in 30 seconds :
"test1" > c:\test.txt
(gci c:\test.txt).creationtime
del c:\test.txt

the creationTime is not refreshed and keep the value of the first execution
time.

It is perhaps linked to the framework .net ? I don't have any idea. Perhaps
it's a bug.

Arnaud
PS: you can submit your bug to the MS connect program. I was impressed when
I saw the list of bugs submitted...

"BatchMan" wrote:
Quote:

> Why is it that when I uncomment the "start-sleep" line in the below script, I
> get the correct value returned for my creationtime--but when I comment it
> out, I do not get the correct creationtime for the file? This is driving me
> nuts! If this seems to work for you the first time you run it, wait a minute
> and run it again.
>
> "test1" > c:\test.txt
> (gci c:\test.txt).creationtime
> del c:\test.txt
> ### You'll get an error when the command below runs b/c the file doesn't
> exist.
> (gci c:\test.txt).creationtime
> #start-sleep 30
> new-item -path c:\test.txt -type "file"
> (gci c:\test.txt).creationtime
>
> --
> BatchMan
My System SpecsSystem Spec