How to Change File and Folder Date & Time Attributes Via the Command Line

Veröffentlicht am: 16 April 2022
auf dem Kanal: OnlineComputerTips
22,679
198

If you need to change the date created, modified or accessed attribute of a file or folder, you can do so using PowerShell with some simple commands. You can even change the date and time attributes for all files within a folder with one command.

Here are the notes from the video.

DATE CREATED
(Get-Item "PathToItem").CreationTime=("15 January 2022 10:00:00")

SAMPLE
(Get-Item "C:\demo\File1.txt").CreationTime=("15 January 2022 10:00:00")

-------------------------------------------------------------------------------

DATE MODIFIED
(Get-Item "PathToItem").LastWriteTime=("16 January 2022 11:00:00")

SAMPLE
(Get-Item "C:\demo\File2.txt").LastWriteTime=("16 January 2022 11:00:00")

-------------------------------------------------------------------------------

DATE ACCESSED
(Get-Item "PathToItem").LastAccessTime=("17 January 2022 12:00:00")

SAMPLE
(Get-Item "C:\demo\File3.txt").LastAccessTime=("17 January 2022 12:00:00")

-------------------------------------------------------------------------------

If date accessed is not changing then run
fsutil behavior set disablelastaccess 0

-------------------------------------------------------------------------------

CHANGE ATTRIBUTES FOR ALL FILES IN A FOLDER
Get-ChildItem -force PathToItem * | ForEach-Object{$_.CreationTime = ("15 January 2022 10:00:00")}
Get-ChildItem -force PathToItem * | ForEach-Object{$_.LastWriteTime = ("15 January 2022 10:00:00")}
Get-ChildItem -force PathToItem * | ForEach-Object{$_.LastAccessTime = ("15 January 2022 10:00:00")}

SAMPLE
Get-ChildItem -force C:\demo\Folder1 * | ForEach-Object{$_.CreationTime = ("15 January 2022 10:00:00")}

Here is a writeup of the process on our website.
https://onlinecomputertips.com/suppor...

Learn More:
Check out our online training courses!
http://madeeasytraining.com

Check out our book titled Windows 11 Made Easy to take your Windows skills to the next level!
https://www.amazon.com/dp/B09HFXWXRY?...

#dateandtime
#filemanagement
#fileexplorer
#windowstipsandtricks
#windowstips


Auf dieser Seite können Sie das Online-Video How to Change File and Folder Date & Time Attributes Via the Command Line mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer OnlineComputerTips 16 April 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 22,679 Mal angesehen und es wurde von 198 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!