Skip to content

How to Read Windows Prefetch Files with PECmd

Use PECmd to read Windows Prefetch files, compare recorded run times with the file’s modified time, and check what a run count can tell you.

By Sourabh6 min read

You have a Windows .pf file and a question about when a program ran.

Open a working copy in PECmd and look for the run times recorded inside.

File Explorer can show when the .pf file was last modified, but that date describes the file on disk.

It is a separate field from the times PECmd reads from the file’s contents.

This walkthrough uses a Windows practice account and an app you launch yourself.

Keep a short log of those launches so you have something independent to compare with PECmd. The example figures are simulated teaching views.

Find the Prefetch File for Your Test App

Windows uses Prefetch to help applications and the system load efficiently.

A Prefetch record can contain run times, a run count, volume details, and references to files and directories.

The fields available depend on the Windows version and the record.

On a Windows practice machine, open PowerShell and choose a harmless desktop program with a distinct executable name.

Classic Notepad is a convenient example on systems where it runs as expected.

On newer installations the app may launch through a different executable or reuse a running instance.

If that makes it difficult to tell which process you started, choose another installed program and record its executable name.

Write down the UTC time immediately before each launch. Let the app load, close it, and make sure it has exited before launching again.

Keep a minute or two between launches so the times are easy to compare. In PowerShell, you can record the current UTC time with:

powershell
(Get-Date).ToUniversalTime().ToString('o')

Inspect C:\Windows\Prefetch from an account permitted to read it. You can list candidate records for Notepad and their filesystem modification time like this:

powershell
Get-ChildItem -LiteralPath (Join-Path $env:windir 'Prefetch') -Filter 'NOTEPAD*.pf' |
    Select-Object Name, LastWriteTimeUtc

A filename often contains the executable name followed by a value derived from execution context.

If there is more than one candidate, keep each record separate.

The matching name prefix alone cannot tell you which record belongs to the executable path or test launches you care about.

Narrow it down by comparing the internal run times and available path or volume information.

Copy the relevant records to a working folder. Keep the acquisition path and any timestamps you need from the source.

For a case, work from a verified acquisition or copy and document how you obtained it.

See the SHA-256 verification walkthrough for a way to check copied bytes.

Keep the source path and filesystem times with your notes when you prepare a working copy.

Parse One File with PECmd

Open PowerShell in the folder containing PECmd.exe. Replace the sample path with the full path to your working copy.

powershell
.\PECmd.exe -f 'C:\Lab\Prefetch\APP-12345678.pf'

The -f option selects one file.

Start with the executable name and source filename, then look for the most recent internal run time and any older run times that are present.

Check the parser’s time display and export settings before comparing any timestamps with your UTC log.

Start with the source file and executable name, then check the run-time fields. This is a simulated view with shortened labels.

For several files, use -d for the folder and export CSV files to a separate location.

powershell
.\PECmd.exe -d 'C:\Lab\Prefetch' --csv 'C:\Lab\Results'

The CSV output documented by PECmd includes a file-level export and a timeline export.

Use the file-level view when you need to see what a single record contains.

Use the timeline view to line up individual run-time entries with other events.

Keep the source filename or record identifier so you can trace a timeline row back to the .pf file.

Confirm the field names in your own version.

Compare the Launch Log, Run Times and Modified Time

Suppose your practice notes show launches at 14:20:01 and 14:23:02 UTC.

In the illustration, the Prefetch record contains run times of 14:20:02 and 14:23:03 UTC.

The source .pf file has a last-write time of 14:23:12 UTC.

The run times agree closely with your observations. The last-write time is later and belongs to the file itself.

The launch log and the times stored inside the file are close in this example. The later modified time describes the Prefetch file.

The time differences in that example are for teaching.

Do not subtract a fixed number of seconds from a file date to turn it into a launch time.

For your own test, label each field, read its time zone, and compare the sequence against your notes.

If you copied the file before noting its filesystem timestamps, be explicit about whether a time came from the source or the copy.

What the Run Count Can Tell You

The run count is a value in the specific record. The retained timestamps are the individual times still available in that structure.

On supported modern formats the structure can hold up to eight recent run times.

A run count larger than the number of timestamps therefore does not give you dates for the earlier launches.

It also cannot establish lifetime usage across other records, reinstalls, or devices.

To test the counter, parse a copy collected after your first launch.

Compare its run count with a copy you collect after another launch.

Confirm both copies represent the same source filename before comparing.

If they differ, keep both observations and look at the executable path, volume details, or other context instead of combining their counts.

What to Check When the Result Looks Wrong

Scroll horizontally if needed to see the full table.

What you seeWhat to check
No candidate .pf fileVerify the executable that actually ran, whether Prefetch is enabled, and whether the collection includes the correct Windows installation and folder.
Multiple records with the same executable prefixCompare all relevant paths, volumes, filenames and recorded times before selecting one.
Internal run times seem hours away from your notesCheck the source time zone, the parser’s display or export settings, and the test system’s clock before drawing a timeline.
PECmd cannot parse a fileConfirm the copy is complete, the tool supports the file format, and the error relates to that exact input. Keep the original and the error message.
A filename appears in referenced resourcesTreat it as a reference recorded in the Prefetch structure. Look for another artifact before claiming that file itself executed.

Missing Prefetch data leaves a gap in this source.

Windows may have been configured differently, the record may no longer be retained, or the relevant volume may be absent from the collection.

Where available, corroborate an execution claim with a process-creation event or another appropriate record.

The Windows event log walkthrough shows where to look for those events, and the Windows artifacts lesson gives the broader context for combining sources.

Record the Finding at the Right Level

Save the source filename and path, the tool and version, the time zone, the extracted fields, and the evidence you used for comparison.

Name the executable and the recorded times.

A Prefetch result by itself generally does not identify the human who launched the program or show what that person did after launch.

You could report the practice result this way.

The Prefetch record contained run times of 14:20:02 and 14:23:03 UTC. Both align with the practice launch log.

The source record’s filesystem last-write time was 14:23:12 UTC. Use that wording as a check on your own notes.

Each time should have a named source.

Was this page helpful?