标签:
cd C:\Eventlog $gap = (Get-Date) - (New-TimeSpan -Days 365) $unusedfiles = Get-ChildItem | where -FilterScript {$_.lastwritetime -lt $gap -and $_.name -ne "eventsave.exe"} | select -ExpandProperty Name ForEach ($unusedfile in $unusedfiles) { Remove-Item $unusedfile }
标签:
原文地址:http://www.cnblogs.com/IvanChen/p/4493770.html