List Your Recently Opened Files from the Command Line

Read Windows' Recent items folder (%APPDATA%\Microsoft\Windows\Recent) with PowerShell to see every file you opened lately.

WindowsdatesFilespowershellLow risk
Run Get-ChildItem "$env:APPDATA\Microsoft\Windows\Recent" sorted by LastWriteTime descending and take the top entries.

01Command

Command
$ Get-ChildItem "$env:APPDATA\Microsoft\Windows\Recent" -File |
  Sort-Object LastWriteTime -Descending |
  Select-Object -First 20 @{n='File';e={$_.BaseName}}, LastWriteTime

02What it does

Every time you open a document, Windows drops a shortcut into the hidden Recent folder — the same data that powers the Start menu's Recent list and File Explorer jump lists. Sorting that folder by LastWriteTime gives a chronological log of what you touched, and each .lnk's BaseName is the document name. The entries are shortcuts, so you can also resolve a path with (New-Object -ComObject WScript.Shell).CreateShortcut($file.FullName).TargetPath if you need the original location.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Get-ChildItem
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Get-ChildItem lists files in a folder and exposes LastWriteTime, which is how the Recent items jump list is read.
  • Get-ChildItem - SS64
    SS64 · technical · 2026-09-17
    Evidence: Demonstrates sorting and selecting the most recent files with Get-ChildItem and Sort-Object LastWriteTime.

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions