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.
01Command
$ Get-ChildItem "$env:APPDATA\Microsoft\Windows\Recent" -File |
Sort-Object LastWriteTime -Descending |
Select-Object -First 20 @{n='File';e={$_.BaseName}}, LastWriteTime02What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-ChildItemEvidence: Get-ChildItem lists files in a folder and exposes LastWriteTime, which is how the Recent items jump list is read.
- Get-ChildItem - SS64Evidence: 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
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
Search inside text files and logs with regex, returning file, line number and match.