A
A
Adept Popken2016-08-10 14:43:17
cmd/bat
Adept Popken, 2016-08-10 14:43:17

How to write .bat'nick with time conditions check?

Hello! I want to write a .bat file to execute certain commands in a certain amount of time.
But something doesn't work :(
Tell me - where is the mistake?

if "%TIME: =0%" lss "23:00:00,00" (if "%TIME: =0%" gtr "07:00:00,00" echo Comand1) else (echo Comand2)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2016-08-10
@saboteur_kiev

Put cron under windows, for example nnCron and use it

A
Andrew, 2016-08-10
@OLS

Your version works great for me:

if "%TIME: =0%" lss "14:00:00,00" (if "%TIME: =0%" gtr "10:00:00,00" (echo RUN) else (echo TOO_EARLY)) else (echo TOO_LATE)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question