用bat批次修改檔案建立和修改時間
1. 指定資料夾
@ECHO OFF
powershell.exe -command "ls 'D:\sss\sss.txt' | foreach-object { $_.LastWriteTime = Get-Date; $_.CreationTime = Get-Date; $_.LastAccessTime = Get-Date;}"
PAUSE
2. 遞迴資料夾中所有檔案
@ECHO OFF
powershell.exe -command "Get-Childitem -path 'D:\project_llj\install\test\' -Recurse | foreach-object { $_.LastWriteTime = Get-Date; $_.CreationTime = Get-Date }"
PAUSE
3. 修改至指定時間
將.LastWriteTime=Get−Date,改為_.LastWriteTime = '03/06/2024 12:13:36'