Thanks Arnaud. On my machine, a sleep time of 15 seconds works, but 14
seconds does not. I didn't know if that would be true for everyone else so I
just changed it to 30.
This isn't the first time inside of a week that I've run into a show
stopping problem converting my existing batch programs to PowerShell (anyone
know how to get a .weekofyear property from a datetime value?). I *really*
want to fall madly in love with PS but I don't think she feels the same
way....
thanks again,
--
BatchMan
"A. Petitjean" wrote:
Quote:
> 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