window 下 bat 计划任务删除保留时间内文件

date 

 

windows 打印时间戳 

年:echo %date:~0,4% 
月:echo %date:~5,2% 
日:echo %date:~8,2% 

星期:echo %date:~10,6% 
小时:echo %time:~0,2% 
分钟:echo %time:~3,2% 
 秒:echo %time:~6,2% 
毫秒:echo %time:~9,2%

window 计划任务 定时删除保留周期时间内文件;

设置执行bat  ;设置 触发器 执行周期;

bat 执行文件示例 :

set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%"

forfiles /p D:\test /S /M * /d -1 /c "cmd /c del @FILE"

forfiles /?   参数格式

猜你喜欢

转载自www.cnblogs.com/sharesdk/p/10289422.html