如果power
shell是可接受的(应该是,因为它在Server 2008上默认启用)试试这个:
原文链接:https://www.f2er.com/windows/370349.html$numberOfDays = 3 $Now = Get-Date $TargetFolder = “C:\myoldfiles” $LastWrite = $Now.AddDays(-$numberOfDays) $Files = get-childitem $TargetFolder -include *.bak,*.x86 -recurse | Where {$_.LastWriteTime -le “$LastWrite”} foreach ($File in $Files) { write-host “Deleting File $File” -foregroundcolor “Red”; Remove-Item $File | out-null }
Souce here.