用bat批量修改文件创建和修改时间
用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'