所以我写了这个脚本,它将清除下载中的文件,但它不起作用
$DaysToDelete = 1
下载
Get-ChildItem "C:\users\*\Downloads\*"-Recurse -Force -ErrorAction SilentlyContinue |
Where-Object { ($_.CreationTime -lt $(Get-Date).AddDays(-$DaysToDelete))} |
remove-item -force -Verbose -recurse -ErrorAction SilentlyContinue