使用powershell递归更改lastwritedate
我正在尝试使用MS Powershell更改文件夹中所有文件以及子文件夹中所有文件的lastwritedate 我走了这么远才找到所有相关文件的列表使用powershell递归更改lastwritedate,powershell,file,file-attributes,Powershell,File,File Attributes,我正在尝试使用MS Powershell更改文件夹中所有文件以及子文件夹中所有文件的lastwritedate 我走了这么远才找到所有相关文件的列表 Get-ChildItem -Path . -Recurse -Filter *.* -File 现在我想更改找到文件的日期 (Get-ChildItem -Path . -Recurse -Filter *.* -File) | (Get-Item).lastwritetime=$(Get-Date "10/10/2019 01:05 pm")
Get-ChildItem -Path . -Recurse -Filter *.* -File
现在我想更改找到文件的日期
(Get-ChildItem -Path . -Recurse -Filter *.* -File) | (Get-Item).lastwritetime=$(Get-Date "10/10/2019 01:05 pm")
但不幸的是,它失败了。有人能帮我吗。好的,现在我找到了解决办法
(Get-ChildItem -Path . -Recurse -Filter *.* -File) | foreach {$_.lastwritetime=$(Get-Date "10/10/2019 01:05 pm")}
这将引导gci的输出,现在我找到了解决方案
(Get-ChildItem -Path . -Recurse -Filter *.* -File) | foreach {$_.lastwritetime=$(Get-Date "10/10/2019 01:05 pm")}
这管道gci的输出BTW,这两个
-Path.
和-Filter*.
都是多余的-这些都是默认值,表达式括号$()
也不需要。顺便说一句,-Path.
和-Filter*.
都是多余的-这些都是默认值,表达式括号$()
也不需要。