Eric wrote:
> Thank everyone very much for suggestions
> Could you please give me any suggestions on how to add following condition
> into batch file?
> If (today is tuesday or wednesday or thursday or friday) and current time is
> between 9 am to 10 am then
> open Dfile.xls
> Do you have any suggestions?
> Thank everyone very much for any suggestions
If you only want to open a file on Friday and on no other day:
======================================================================
@echo off
for /f "tokens=1 delims=/.- " %%A in ('echo %date%') do (set day=%%A)
for /f "tokens=1-2 delims=:." %%a in ('echo %time%') do (set tm=%%a%%b)
if /i %tm% LSS 900 goto eof
if /i %tm% GTR 1000 goto eof
if /i %day%==fri goto friday
goto :eof
:friday
"D
file1.xls"
======================================================================
If you want to open different files based on day or the week:
======================================================================
@echo off
for /f "tokens=1 delims=/.- " %%A in ('echo %date%') do (set day=%%A)
for /f "tokens=1-2 delims=:." %%a in ('echo %time%') do (set tm=%%a%%b)
if /i %tm% LSS 900 goto eof
if /i %tm% GTR 1400 goto eof
if /i %day%==sun goto sunday
if /i %day%==mon goto monday
if /i %day%==tue goto tuesday
if /i %day%==wed goto wednesday
if /i %day%==thu goto thursday
if /i %day%==fri goto friday
if /i %day%==sat goto saturday
:sunday
"D
file1.xls"
goto :eof
:monday
"D
file2.xls"
goto :eof
:tuesday
"D
file3.xls"
goto :eof
:wednesday
"D
file4.xls"
goto :eof
:thursday
"D
file5.xls"
goto :eof
:friday
"D
file6.xls"
goto:eof
:saturday
"D
file7.xls"
======================================================================
John