In Windows 10 and 11, every file stores system metadata, including the creation time, last modification time, and last access time, which are automatically updated whenever data operations are performed.
The need to manually modify these parameters appears during archive migration, document structure recovery, or software testing when standard operating system graphical interfaces do not provide tools for editing these attributes. It can also be useful in situations where you need to remove traces of when certain file operations were performed.
The traditional Command Prompt (CMD) does not provide direct control over file timestamps with custom values. Its built-in commands, such as copy, can only apply the current system time during file replacement and cannot assign a specific custom date or modify creation and access times without third-party utilities.
Unlike CMD, the PowerShell environment has direct access to .NET Framework classes, allowing programmatic interaction with file system properties and precise control over timestamp values.
To manage file timestamps through PowerShell, use the System.IO.File class. Before running commands, it is recommended to close the file in other applications to avoid access lock errors.
- The fastest way to open this utility is: press
Win + R, typepowershell, and pressEnter
Changing a file creation date
To modify a file’s creation time, use the SetCreationTime method.
The command requires the full file path and the desired date in a format supported by the Get-Date cmdlet.
[System.IO.File]::SetCreationTime("C:\path\to\file.txt", (Get-Date "2026-09-11 14:30:00"))
example:
[System.IO.File]::SetCreationTime("C:\Users\Administrator\Desktop\File.txt", (Get-Date "2026-09-11 14:30:00"))
Verification: To confirm that the creation date has changed, right-click the file, select “Properties,” and open the “Details” tab, or run the following PowerShell command:
(Get-Item "C:\path\to\file.txt").CreationTime
Changing a file modification date
The modification date indicates when changes were last made to the contents of a document.
To manually adjust this value, use the SetLastWriteTime method.
[System.IO.File]::SetLastWriteTime("C:\path\to\file.txt", (Get-Date "2026-09-11 14:30:00"))
example:
[System.IO.File]::SetLastWriteTime("C:\Users\Administrator\Desktop\File.txt", (Get-Date "2026-09-11 14:30:00"))
Verification: Open the file properties in Windows Explorer under the “General” tab or check the value from the console using:
(Get-Item "C:\path\to\file.txt").LastWriteTime
Changing a file access date
The last access timestamp records the moment when a file was opened for reading or viewing.
This parameter can be modified using the SetLastAccessTime method.
[System.IO.File]::SetLastAccessTime("C:\path\to\file.txt", (Get-Date "2026-07-20 18:00:00"))
example:
[System.IO.File]::SetLastAccessTime("C:\Users\Administrator\Desktop\File.txt", (Get-Date "2026-07-20 18:00:00"))
Verification: The current access date can be checked in PowerShell using:
(Get-Item "C:\path\to\file.txt").LastAccessTime
Batch Changing File Metadata in a Folder
To apply a creation date change to all files inside a specific folder, use the Get-ChildItem cmdlet together with the ForEach-Object processing loop, which passes each file one by one to the .NET method.
Batch changing file creation dates
Run the following script, replacing the folder path with the actual directory location and setting the required date:
Get-ChildItem -Path "C:\path\to\folder" -File | ForEach-Object {
[System.IO.File]::SetCreationTime($_.FullName, (Get-Date "2026-05-10 14:30:00"))
}
For example:
Get-ChildItem -Path "C:\Users\Administrator\Desktop\New folder (2)" -File | ForEach-Object {
[System.IO.File]::SetCreationTime($_.FullName, (Get-Date "2026-05-10 14:30:00"))
}
The -File flag ensures that the command affects only files in the selected directory while skipping subfolders.
Result verification: Display a list of all files in the folder along with their creation dates to confirm that the operation was completed successfully:
Get-ChildItem -Path "C:\path\to\folder" -File | Select-Object Name, CreationTime
To change the creation date simultaneously for all files and folders inside a directory, remove the -File filter and use direct property assignment through built-in PowerShell objects.
Unlike the strict .NET methods, PowerShell file system objects provide a universal way to work with both files and directories.
Batch changing timestamps in the current directory
Run the command without limiting the object type:
Get-ChildItem -Path "C:\path\to\folder" | ForEach-Object {
$_.CreationTime = (Get-Date "2026-05-10 14:30:00")
}
Including all nested subfolders
If you need to process the entire folder structure recursively (including all child folders and their contents), add the -Recurse parameter:
Get-ChildItem -Path "C:\path\to\folder" -Recurse | ForEach-Object {
$_.CreationTime = (Get-Date "2026-05-10 14:30:00")
}

I’m Irina Petrova-Levin, a graduate of the Moscow Technical University of Communications and Informatics (MTUCI), where I earned my degree in Information Technology. My professional journey has been deeply rooted in JavaScript, PHP, and Python, driven by a profound fascination with how modern technology shapes our everyday lives. I strive to explain complex processes in a clear and accessible way without ever sacrificing accuracy or missing the core of the matter.
Now based in Dallas since 2019, my work reflects a unique synthesis of Eastern European engineering depth and the dynamic American tech mindset. This blend allows me to bridge two distinct technological traditions.
My goal is to deconstruct the real mechanisms behind the devices and systems we use daily. In my articles, I aim to deliver information that is not only practical and structured but also reveals the hidden logic of how our world actually works.






