WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Launching WinBatch and Other Apps
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Run a Job only Once a Day, Regardless of Whether or Not the Machine has been Rebooted

Keywords: 	 runonce run once a day

Question:

I'm using WinBatch 32-99g and I'm trying to create a WBT file that runs a program ONLY ONCE at the first boot-up of each day.

Any help would be appreciated.

Answer:

  1. This is just an idea, you can create a script that would run upon startup and then add the system time to a generic text file. You can have prior to the programs execution a check of the system date field. If the system time/date field is greater than 24 hours (or whatever duration fits you best) than run if it is less than bypass the execution of the program.

  2. You can also use windows schedule program that will also allow you run script at specific timeframe.

    You have your choice of scheduling agents to work with. Microsoft Plus, Norton AntiVirus and Novell ZenWorks all provide scheduling agents for Windows. There are also many others available, take a look at http://www.winfiles.com for some very good freeware/shareware software. Or, you can take the hard road and write your own scheduling logic.

    The key point in writing your script is remembering whether or not you have run on a any given day. To do this you need some sort of non-volatile storage to keep track of this. You could store the date for the most recent time that the script ran successfully in a file (.INI file perhaps) or in the system registry (under HKEY_LOCAL_MACHINE).

    Whether your script gets started at system startup or logon time and lurks continuously in the background or whether it is started at a set time by a scheduling agent is not important as long as your script is capable handling the situation where it gets restarted or run more than once on any given PC.

    If you need to coordinate the running of the script to happen only a single time but the script may be run from some arbitrary # of workstations then your choice of where to store the most-recently-run-date information will have to be in some non-volatile location that is equally accessible to all of the workstations that can run the script.


Article ID:   W14247
Filename:   Run only Once a Day Regardless of Reboot.txt
File Created: 1999:10:26:11:22:48
Last Updated: 1999:10:26:11:22:48