Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, I wonder if you can help me please - I need to write a .BAT file to perform a given action on a given day each week, so for example, if today is a Wednesday, then engage this command (the command could be anything, and it's not that which I'm interested in).
How do I write ... in a .BAT file (to run under Windows XP Pro) ... a command that will calculate the day of the week please ?
I HAD a .BAT file that worked on Windows 2000, the text of which was like this :-
@ECHO OFF
@For /F "tokens=1,2,3 delims=. " %%A in ('Date /t') do @(
Set Day=%%A
)IF %day%==Mon goto :URLSMONDAY
IF %day%==Tue goto :URLSTUESDAY
IF %day%==Wed goto :URLSWEDNESDAY
IF %day%==Thu goto :URLSTHURSDAY
IF %day%==Fri goto :URLSFRIDAY
EXIT
END
:URLSMONDAY
monday.htmlEXIT
:URLSTUESDAY
monday.htmlEXIT
:URLSWEDNESDAY
monday.htmlEXIT
:URLSTHURSDAY
monday.htmlEXIT
:URLSFRIDAY
friday.htmlEXIT
Basically I used this to call up a list of internet sites I needed to visit on given days - e.g. Monday I need to check my bank balance, Tuesday I need to visit a forum, Wednesday something else, etc., etc. I automate the .BAT file to run at 7am using the Task Scheduler, so by the time I get to work all the pages are waiting for me ...
Cheers guys,
David.

An annoying difference betwen Win 2K and XP is the lack in XP of the Day of Week in the Date command. To work around that you can parse the output of
Echo.|Command /C Date
that forces the legacy DOS format including Day of Week. I can adjust your batch, but I need you report *exactly* what is displayed by the above command as I'm running an italian version of XP and to parse the text I need to know it as is.

"An annoying difference betwen Win 2K and XP"
Yeah, one of many.
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |