powershell脚本按期删除windows日志

例: 按期删除3天前的日志ide

$FilePath = "C:\Windows\System32\LogFiles"
$DaysAgo=3
$Today=Get-Date  

Get-ChildItem -Path  $FilePath "*.log" | Where-Object {$_.LastWriteTime -lt $Today.AddDays(-$DaysAgo)} |Remove-Item
相关文章
相关标签/搜索