Script with IF (time) less than

0

Good afternoon, I'm behind a command (cmd / batch) to execute a command with a condition.

Ex: Checking the user name

 SET var=%username%
    IF "%var%"=="Carlos" (msg Carlos 'usuario confirmado')

    pause

I would like another to also check the time, to be displayed the good morning msg, good afternoon, good evening.

If you can help me ... thank you right away

    
asked by anonymous 24.09.2018 / 20:09

1 answer

1
 SET var= "Digite o usuário"
    IF %var%=="Carlos" Goto MSG

:MSG
 Echo "Carlos usuario confirmado"
    pause

And for the test date this:

echo %time:~0,2%

if %time:~0,2%  LEQ 12 goto manha
if %time:~0,2%  LEQ 18 goto tarde
if %time:~0,2%  LEQ 24 goto noite

:manha
    echo "manha"
    Pause

:tarde
    echo "tarde"
    Pause

:noite
    echo "noite"
    Pause
    
24.09.2018 / 21:45