一、新建bat文件
:: 清理文件
@echo off
title 清理文件
:: 指定IIS文件目录
set file_dir="D:\web\log"
:: 指定删除的文件类型
set file_type="*.log"
:: 保留天数
set save_day=3
:: 删除文件
forfiles /p %file_dir% /S /M %file_type% /D -%save_day% /C "cmd /c echo 正在删除@relpath 文件… & echo. & del @file"
二、新建计算机定时任务,定时执行bat文件