用 Get-Item 查看文件的创建和修改时间
NTFS 的三个时间戳,一行 PowerShell 全部读出来。
运行 Get-Item <文件> | Select-Object CreationTime, LastWriteTime, LastAccessTime 即可显示三个时间戳。
01命令
命令
$ Get-Item 'C:\Temp\report.xlsx' | Select-Object Name, CreationTime, LastWriteTime, LastAccessTime02作用说明
LastWriteTime 就是 dir 和资源管理器里显示的“修改日期”;CreationTime 是文件在该位置创建的时间;LastAccessTime 经常不准确,因为 Windows 出于性能考虑默认不更新访问时间。这些属性均可写,脚本复制文件后常用它来还原原始时间。加 -Force 可包含隐藏和系统文件。
03风险
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Get-Item | Microsoft Learn依据: Microsoft documents Get-Item returning the object at a path, whose FileSystemInfo members include CreationTime, LastWriteTime, and LastAccessTime.
- Get-Item - PowerShell依据: SS64 describes Get-Item returning FileSystemInfo objects exposing the timestamp properties, including via .GetType() inspection.
最后验证: 2026-09-17 · 分类: 文件与文件夹