【发布时间】:2013-09-16 23:05:38
【问题描述】:
当我运行这个脚本时,它没有输出。我认为这很明显,但尽管它创建了 test.txt,但它删除的文件中没有数据放入其中!
提前致谢
$limit = (Get-Date).AddDays(-7)
Get-ChildItem 'C:\temp' -Recurse |
Where-Object {
-not $_.PSIsContainer -and $_.CreationTime -lt $limit
} | Remove-Item | Out-File -FilePath c:\text.txt
【问题讨论】: