如何编写批处理文件,根据日期而不是时间提供最新文件?

时间:2018-02-19 06:47:44

标签: cmd

想写:

  • 列出项目

  • 批处理文件,根据日期提供最新文件。

1 个答案:

答案 0 :(得分:0)

分两步完成:a)获取最新文件,b)使用它的日期过滤文件:

@echo off
REM get the newest file (to get it's date):
for /f "delims=" %%a in ('dir /a-d /b /od /tw') do set "day=%%~ta"
REM show files, filtered by the found day:
for /f "tokens=4 delims= " %%a in ('dir /a-d^|find "%day:~0,10%"') do echo %%a