Web Hosting, Design, & Coding forum

General discussion

Creating a batch file which can open document on certain day

by mike9287 / September 7, 2006 12:27 AM PDT

Hello,

I want to write a small batch file to open certain documents on my computer when I log on, that quite easy a certain document only needs to be open on fridays so I need to find a way of checking the system date and then using something like. I asked elsewhere but didnt get much help, a guy said something about using a VBscript although I have no experience in VB, and little in batch file scripting.

if date ==friday
then open myfile.doc
else
end

Can anyone give me some help with this?

I am using XP BTW.

Cheers

Mike

EDIT: I plan to put the .BAT file in my start folder and hope to run a check daily to see if day == friday.

Discussion is locked
You are posting a reply to: Creating a batch file which can open document on certain day
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Creating a batch file which can open document on certain day
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Hint
by R. Proffitt Forum moderator / September 7, 2006 12:36 AM PDT
http://www.chebucto.ns.ca/~ak621/DOS/Bat-Adv2.html notes XSET and DAYOFWEEK in a batch file.

Tailor to fit.

In closing, I don't offer to write the code for you since it's your code to create and maintain.

Bob
Collapse -
Cheers
by mike9287 / September 7, 2006 1:25 AM PDT
In reply to: Hint

Thanks for the info, I was thinking though...I need to work with the date as a sring such as "Friday" but I think I can only get a numeric value from DOS.

Do you know this to be true? or..do you think what i am trying to do is possible another way?

thanks again

Mike

Collapse -
Very odd. Why must it be Friday?
by R. Proffitt Forum moderator / September 7, 2006 1:33 AM PDT
In reply to: Cheers

That's a new requirement. Please explain in detail why the dayofweek test must be for friday and not the number of the day of the week.

Bob

Collapse -
reply to Bob
by mike9287 / September 7, 2006 1:40 AM PDT

Well I want to say something like:

if %DAY% == friday
then START myfile.doc
ELSE
END

if I have a numeric date then that value will change, for instance tomorrow is 08/.. next week 15/.. etc, when the month changes the pattern does too, some months have 31 some 28 and some 30. How would I reference an ever changing number value with only a bash script?

Mike

Collapse -
Ahh, consider this...
by R. Proffitt Forum moderator / September 7, 2006 4:12 AM PDT
In reply to: reply to Bob

The DAYOFWEEK is from 0 to 6 or 1 to 7, not the day of the month.

Tell me why it must be Friday and not the number again.

Bob

Collapse -
Huh? Let's look at some examples...
by steve749 / September 7, 2006 6:10 AM PDT
In reply to: Cheers
Link to Guide showing that there is a "vbFriday" constant with a value of 6 as it is the 6th day of the week. Now in the script you should be able to get the Date and then get the day of week value out of it.

Get Date link

Weekday function

So why not combine those 2 functions and see if the value is 6? It may help to run some examples as I think you may not understand how various Date functions work since while the date is a number there are several numbers in it, day of the week, month and year being just a few elements.

Regards,
JB
Collapse -
Ok i know this is old but
by ozote / November 10, 2010 3:59 AM PST

The links provided no longer work =(
How can i select the Current Day (11102010) instead of Wednesday?

Hope someone can read this soon xD

thanks!

Popular Forums

icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

FALL TV PREMIERES

Your favorite shows are back!

Don’t miss your dramas, sitcoms and reality shows. Find out when and where they’re airing!