Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

start batch file based on day of week

Status
Not open for further replies.

Kanuhead

Technical User
Sep 23, 2003
2
CA
I'm no programmer but I wrote a simple batch file that runs from a login script to backup users data. I would like to enhance it to run one command on Friday and another on any other day. I think what I need would be an IF - THEN - ELSE type sequence that can retreive the weekday.
All suggestions are greatly appreciated.
 
What about using task scheduler (Accessories/system Tools)?
 
I can't use the task schedular because the batch file fires from a domain logon script. This prevents the batch file from running when the user is not logged onto the network. The Batch file itself backs-up data to the network.
Thanks for the reply.
 
Then, yes you'd need an if clause, having extracted the day of the week from the date variable (there are a number of posts on the forums which tell you how to do this if you don't know - which I don't off the top of my head - eg, thread616-605573 is close - something like for /f %a in ('date /t') do set b=%a - remember need %% in batch file).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top