How to Update a File's Creation Time in PowerShell

PowerShell makes it easy to update the creation time for files in a directory:

Get-ChildItem -File | ForEach-Object {
    $_.CreationTime = Get-Date
}

This command finds every file in the current directory and sets its creation time to the current date and time.

But what if you only want to update a single file?

Update One File

Use Get-Item to reference the file directly:

(Get-Item ".\example.txt").CreationTime = Get-Date

Replace example.txt with the name of your file. You can also provide the full path:

(Get-Item "C:\path\to\example.txt").CreationTime = Get-Date

Set a Specific Creation Time

Instead of using the current date and time, you can assign a specific value:

(Get-Item ".\example.txt").CreationTime = [datetime]"2026-09-07 12:00"

This sets the file’s creation time to September 7, 2026, at noon.

Use a File Filter

If you prefer to keep the pipeline-based approach, filter for the exact filename:

Get-ChildItem -File -Filter "example.txt" | ForEach-Object {
    $_.CreationTime = Get-Date
}

For a single known file, the direct Get-Item approach is the simplest:

(Get-Item ".\example.txt").CreationTime = Get-Date