Get-ChildItem -Path '\folder_path' -Recurse |
Foreach-Object {
(Get-Item $_.FullName).LastWriteTime=$(Get-Date -format o)
}
您的代码只更新内存中的属性。要更改磁盘上的实际文件,您需要使用Set-ItemProperty
。例如:
Set-ItemProperty -Path $_.FullName -Name LastWriteTime -Value (Get-Date)