-
-
Save Kielx/bf64220d43e966604ba384b1fc8e1954 to your computer and use it in GitHub Desktop.
Change the last modified, creation and access time of files in Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Change Timestamps in Windows | |
| ## Get Started | |
| ### Open PowerShell | |
| Open PowerShell in the target directory. Normally, you can open PowerShell in current directory by holding <kbd>shift</kbd> and right-clicking the context menu **Open PowerShell Here**. | |
| ### Use the Following Commands | |
| #### Change Creation Time | |
| ``` powershell | |
| $(Get-Item FILENAME).creationtime=$(Get-Date "DD/MM/YYYY HH:MM am/pm") | |
| ``` | |
| #### Change Last Access Time | |
| ``` powershell | |
| $(Get-Item FILENAME).lastaccesstime=$(Get-Date "DD/MM/YYYY HH:MM am/pm") | |
| ``` | |
| #### Change Last Modified Time | |
| ``` powershell | |
| $(Get-Item FILENAME).lastwritetime=$(Get-Date "DD/MM/YYYY HH:MM am/pm") | |
| ``` | |
| ## Examples | |
| To change the creation time of the file `filename.mp4` in current folder to current date time, use the following command. | |
| ``` powershell | |
| $(Get-Item ".\filename.mp4").lastwritetime=$(Get-Date) | |
| ``` | |
| To change the last modified time of the file `filename.mp4` in current folder to **11/24/2015 06:00 am**, use the following command. | |
| ``` powershell | |
| $(Get-Item ".\filename.mp4").lastwritetime=$(Get-Date "11/24/2015 06:00 am") | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment