Startup batchfile

  • Thread starter Thread starter Walter Schulz
  • Start date Start date
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
 
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
 
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
 
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
 
Walter you can discard my previous mail.
I worked with your batch file and it is perfect.
Many thanks again.God Bless.

Regards,

Jerry
 
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
 
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
 
Back
Top