creating a batch file to run commands on a certain day

Status
Not open for further replies.
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.
 
Why not just use a batch file and use "scheduled tasks" in your control panel?
 
Create a batch file, and in that file put the path to the file you want to open. For example, your batch file might have ONE line (with quotes) that says:

"c:\documents and settings\jon\my documents\coolfile.doc"

Save this batch file wherever you like.

Next go to Start->All Programs->Accessories->System Tools->Scheduled Tasks and create a new task. Point it to your batch file, and set the schedule.
For the username, you often just use "NT AUTHORITY\SYSTEM" with no password.

Then each time the scheduled time is reached, it runs your batch file, which opens your other file.

If you want to get fancy, it will require a couple more commands, or go to vbscript. For example, if you use the batch file method, the DOS prompt window will stay open until your file is closed. You can prevent that if you like, but this is a start, see if it works!
 
Oh, LNC you beat me to the punch, got your post in before I finished.

But note, I tried doing this myself, and everything is good except it actually isn't running the batch file! It says the task is "running" but nothing happens. Maybe it can't work with batch?

We'll see.

In any case, the Scheduled Tasks is what you should run, but we might have to make an executable instead of a batch.
 
Status
Not open for further replies.
Back