Startup batchfile

W

Walter Schulz

Anyways, I need a batchfile that will look at the system time. If the time
is between 19:00 and 07:00 it should execute batchfile1 and if it is another
time it should execute batchfile2

if %time:~0,2% GTR 19 goto :batch1
if %time:~0,2% LSS 7 goto :batch1
call batch2
goto :EOF
:batch1
call batch1
goto :EOF

Ciao, Walter
 
J

Jerry Robles de Medina

Hi,
I have been searching and trying to make a batchfile but I am done.I am new
to batch files so...
Anyways, I need a batchfile that will look at the system time. If the time
is between 19:00 and 07:00 it should execute batchfile1 and if it is another
time it should execute batchfile2

Thanks very much,
Jerry Robles de MEdina
 
W

Walter Schulz

if %time:~0,2% GTR 18 goto :batch1
if %time:~0,2% LSS 7 goto :batch1
call batch2
goto :EOF
:batch1
call batch1
goto :EOF
 
J

Jerry Robles de Medina

Hi Walter,
Thanks very much.

Were you say goto:batch1 I can just use batch1.bat, or should I put that
somewhere else.
Thanks again for your great help.
regards, Jerry
 
J

Jerry Robles de Medina

Walter you can discard my previous mail.
I worked with your batch file and it is perfect.
Many thanks again.God Bless.

Regards,

Jerry
 
J

Jerold Schulman

Hi,
I have been searching and trying to make a batchfile but I am done.I am new
to batch files so...
Anyways, I need a batchfile that will look at the system time. If the time
is between 19:00 and 07:00 it should execute batchfile1 and if it is another
time it should execute batchfile2

Thanks very much,
Jerry Robles de MEdina

Type the following exactly, including spaces and capitalization.
Copy/ paste would be better.

for /f "Tokens=1 Delims=: " %%h in ('@echo %time%') do set /a hour=100%%h%%100
if %hour% GEQ 19 call batchfile1.bat&goto :EOF
if %hour% LEQ 6 call batchfile1.bat&goto :EOF
call batchfile2.bat




Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
J

Jerry Robles de Medina

Also a big thank you to you Jerold.
You guys have been great.This is two solutions for me.
They both work great
Thanks,

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top