I am trying to find the last execution date of a bat file I opened in Windows 7. I already tried right clicking the file in Windows Explorer and selecting Properties, but the "last opened" date is a completely different date to when I opened it.

I am certain that it was yesterday, but I am looking for the time it was opened.

link|improve this question

79% accept rate
feedback

2 Answers

up vote 2 down vote accepted

Windows does not keep "last execution" time anywhere.

The closest you can get is the "last access" time (possibly labelled as "last open"); however, it is only accurate to an hour or so, for performance reasons, and Windows 7 doesn't even track it by default.

link|improve this answer
Ok that's a shame. I'll keep track of it manually then. – Marnix Oct 15 '11 at 16:12
It also increasingly became an ineffective measurement as basically any process could cause the last access time to update. . . – surfasb Oct 16 '11 at 1:29
@surfasb: Such processes as antivirus scanners or file indexers can tell Windows to not update the timestamp‌​. – grawity Oct 16 '11 at 18:17
@grawity: This is also true. My point was last access time ultimately wasn't a very effective attribute for tracking file access, since any process was allowed to change it. – surfasb Oct 16 '11 at 20:05
feedback

This was fun. My own batch logging, never even thought about it before, but it seems to work. I just put this echo redirection into the batch, and used these time and date enviroment variables I found on the web.

ECHO >>C:\WhatTimeBatch.log The Dingleberry Batch Was run at %TIME% %DATE%

The single > would redirect to a file and have only one entry, the >> will append. Potentially you could have a simple echo like this in every batch with a different tag, and use the same One log for any batches. Or get extravagent with simplistic error loggin or place tagging by putting it in other places in the batch.

ECHO >>C:\WhatTimeBatch.log The Haldron batch made it to the Copy tag at %TIME% %DATE%
ECHO >>C:\WhatTimeBatch.log The Haldron Batch may have finished the copy at %TIME% %DATE%

ECHO >>C:\WhatTimeBatch.log Test Batch had an error grt0 at the 3rd find %TIME% %DATE%

ECHO >>C:\WhatTimeBatch.log The Check batch got to the 4th Exit at %TIME% %DATE%

the NtfsDisableLastAccessUpdate can be turned back on in windows7.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.