我每天在任务调度程序中使用下面的脚本来删除一些文件:
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中的一些设置)?
谢谢
发布于 2020-08-22 06:36:07
remove-item将删除该文件,而不将其发送到回收站。
https://stackoverflow.com/questions/52410827
复制相似问题