Batch File compare 3 Strings in a row, multiple strings

淺唱寂寞╮ 提交于 2020-01-06 23:45:27

问题


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
    )

来源:https://stackoverflow.com/questions/31547576/batch-file-compare-3-strings-in-a-row-multiple-strings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!