3

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.

2 Answers 2

5

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.

8
  • Ok that's a shame. I'll keep track of it manually then.
    – Marnix
    Oct 15, 2011 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, 2011 at 1:29
  • @surfasb: Such processes as antivirus scanners or file indexers can tell Windows to not update the timestamp. Oct 16, 2011 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, 2011 at 20:05
  • 1
    @grawity actually, i'm sure they must keep it somewhere. reason being, in control panel when you go to "programs & features" you have the option to sort the programs by how often they are used (which is run/executed) since this will not be based on last accessed time. then, in their description, they quote usage frequency with terms such as "rarely", "sometimes", "often", "regularly" etc (this was in vista), now in Win7, if you right click on the columns & select "more..." of installed program listings control, you'll see a "Last Used On" option! Any ideas? I am in need of this too.
    – user51047
    Jul 21, 2013 at 4:58
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .