Changing File Creation & Modification Dates with Powershell in Windows

Changing file creation and modification dates using Powershell in Windows.

Open powershell (c:\Windows\system32\Windowspowershell\v1.0\powershell.exe)

Change to directory containing files needing modification using (chdir) command and issue the following commands for each file that you’re needing to change:

$(Get-Item 'file-name-including-extenstion').creationtime=$(Get-Date "mm/dd/yyyy hh:mm:ss pm")
$(Get-Item 'file-name-including-extenstion').lastwritetime=$(Get-Date "mm/dd/yyyy hh:mm:ss pm")

And if neccessary, change last access time:

$(Get-Item 'file-name-including-extenstion').lastaccesstime=$(Get-Date "mm/dd/yyyy hh:mm:ss pm")

Leave a Reply

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