Using PowerShell To Change File’s Created/Modified/Access Timestamps

File timestamps can be modified on Windows using PowerShell.
Command Syntax:

(Get-Item YourFilePath).CreationTime = "mm/dd/yyyy hh:mm"

Time can be specified using a 24-hour clock, or using am/pm.

There are three settable timestamps:

  • CreationTime will affect the Created timestamp.
  • LastWriteTime will change the Modified timestamp.
  • LastAccessTime will change the Accessed timestamp.

Example:

(Get-Item MyFilename).CreationTime = "10/23/2017 12:56pm"
(Get-Item MyFilename).LastWriteTime = "10/23/2017 12:56pm"
(Get-Item MyFilename).LastAccessTime = "10/23/2017 12:56pm"

Results (from the File Explorer file properties dialog):

About Jeff Fitzsimons

Jeff Fitzsimons is a software engineer in the California Bay Area. Technical specialties include C++, Win32, and multithreading. Personal interests include rock climbing, cycling, motorcycles, and photography.
This entry was posted in Technology, Windows. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *