命令行查看最近打开过的文件

用 PowerShell 列出 Windows 的 Recent 记录文件夹,找回最近编辑却忘了存哪里的文件。

Windows日期文件PowerShell低风险
运行 Get-ChildItem "$env:APPDATA\Microsoft\Windows\Recent" 按 LastWriteTime 倒序排列,取前几条即可。

01命令

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

02作用说明

每次打开一个文档,Windows 都会在隐藏的 Recent 文件夹里放一个快捷方式——开始菜单的"最近使用"和资源管理器跳转列表用的就是这份数据。按 LastWriteTime 排序就得到一份按时间排列的操作记录,.lnk 的 BaseName 就是文档名。这些条目都是快捷方式,如需原始路径可用 WScript.Shell 的 CreateShortcut 读取 TargetPath。

03风险

风险低风险

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • Get-ChildItem
    Microsoft Learn · vendor-doc · 2026-09-17
    依据: 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
    依据: Demonstrates sorting and selecting the most recent files with Get-ChildItem and Sort-Object LastWriteTime.

最后验证: 2026-09-18 · 分类: 文件与文件夹

06相关方案