我每天在任务计划程序中使用以下脚本删除一些文件:
Get-ChildItem -Path "C:\Temp\*.txt" -force -ErrorAction SilentlyContinue | where {($_.LastwriteTime -lt (Get-Date).AddDays(-1) ) -and (! $_.PSIsContainer)} | Remove-Item -Verbose -Force -ErrorAction SilentlyContinue
它起作用了。但是,这些文件将被发送到回收站。所以我们还是需要清空回收站一段时间。有没有办法通过使用ps脚本(或者windows中的某些设置)发送到回收站来删除文件?
谢谢