1. TechSpot is dedicated to computer enthusiasts and power users. Ask a question and give support. Join the community here.
    TechSpot is dedicated to computer enthusiasts and power users.
    Ask a question and give support.
    Join the community here, it only takes a minute.
    Dismiss Notice

creating a batch file to run commands on a certain day

By Mike1981
Sep 7, 2006
  1. 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

    Can anyone give me some help with this?

    I am using XP BTW.



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

    LNCPapa TS Special Forces Posts: 4,247   +448

    Why not just use a batch file and use "scheduled tasks" in your control panel?
  3. Vigilante

    Vigilante TechSpot Paladin Posts: 1,666

    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!
  4. Vigilante

    Vigilante TechSpot Paladin Posts: 1,666

    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.
Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...