I have a long text file that I want to extract ALL the lines with Today's Date. I have tried several ways. This is one of the attempts . . .
Code: Select all
@echo off
>"%UserProfile%\Desktop\Report_DISM.txt" FindSTR "%date%" "%UserProfile%\Desktop\dism.log"
Pause
The files text output at the beginning of each line is in the date format YYYY-MM-DD which could well be different to the local date format.
If I put "2020-05-18" after the FindSTR it works and extracts ALL the rows with Todays Date, but I would like it to automatically pick up Today's Date in the format "YYYY-MM-DD".
Thanks in advance.
UPDATE:
Tried these but they didn't work . . .
Code: Select all
>"%UserProfile%\Desktop\Report_DISM.txt" FindSTR "(date.exe +"%%Y-%%m-%%d")" "%UserProfile%\Desktop\dism.log"
Code: Select all
>"%UserProfile%\Desktop\Report_DISM.txt" FindSTR "(date.exe +"%%YYYY-%%MM-%%DD")" "%UserProfile%\Desktop\dism.log"