I want to check a condition, if two files' modified dates have been updated to system's date, then trigger something. My code works, except %DATEONLY%==%SystemDate%==%ZipONLY% , this part has some issue, what is the right format for compare 3 Strings in Batch? or is there a way to separate them? Thanks ALL!!
@ECHO OFF
FOR /f "tokens=1,2,3,4 delims=. " %%i in ('date /t') do set SystemDate=%%k%%j
echo %SystemDate% is System Date
pause
FOR %%a IN (D:\MyFile.txt) DO SET FileDate=%%~ta
set DATEONLY=%FileDate:~0,10%
echo %DATEONLY% is Modified date
pause
FOR %%a IN (D:\Daildn.txt) DO SET ZipDate=%%~ta
set ZipONLY=%ZipDate:~0,10%
echo %ZipONLY% is Modified date
pause
:CHECK
if %DATEONLY%==%SystemDate%==%ZipONLY% (
START C:\DailyRun.bat
) else (
cls
ECHO Please Waiting for files to get ready
timeout /t 10 /nobreak
GOTO :CHECK
)