DOS比较运算符(LSS,LEQ,GTR,GEQ,EQU,NEQ)(dos与windows的区别)一看就会

随心笔谈12个月前发布 admin
100 0


:: DateDel.bat – 演示删除7日前(含第7日前)修改的文件
:: Will Sort – 2021-8-26 – CMD@WinXP
:: Note: 不要将此批处理文件置于需要选择删除文件的目录中
:: 程序只是进行了删除演示,若演示无误,删除del前面的echo即可正常执行
:: 如果首次执行的日期不是2021-8-26,则需调整第四行代码中的保留日期列表
:: 程序需要每日运行至少一次,以便自动更新日期列表
@echo off
if “%1″==”:” goto %2
if exist %temp%.\_DateDel.bat %temp%.\_DateDel.bat
%0 : Update 2021-08-20 2021-08-21 2021-08-22 2021-08-23 2021-08-24 2021-08-25 2021-08-26

:Update
setlocal EnableExtensions
set today=%date:~0,10%
if not “%today%”==”%9” %0 : Update %4 %5 %6 %7 %8 %9 %today%
echo %0 : Update %3 %4 %5 %6 %7 %8 %9 >%temp%.\_DateDel.bat

:Delete
for /r %%f in (*.*) do if “%%~tf” LEQ “%3” echo del “%%f”

:End

© 版权声明

相关文章