Contents of the IFTODAY.DOC file
Page 1 IFTODAY
A Simple Batch FIle Control Utility
from MidWest BBS
St. Charles, IL
There are several fine utilities available to control whether
or not a program and/or batch file is executed based on certain
criteria. Frankly, we felt that most were overly complicated
or didn't meet our needs on MidWest. We developed this
program to control our daily "event" batch file on the BBS,
since there are a number of programs which don't need to be
executed every day.
The basic premise is simple, based on the day of the week or
month a command is either passed to DOS or is skipped. The
syntax is as follows:
IfToday [Which Day] [Command Line]
"Which Day" is either a day of the week, day of the
month, odd/even days or beginning or ending of the month,
etc. "Command Line" is the normal command passed to DOS.
A few examples should make this clear.
Example 1: IfToday Friday Vopt
If you wanted to optimize your disk only on
Friday, this is the way it would look.
IfToday checks the internal clock and if it
is Friday then Vopt is executed, if not,
Example 2: IfToday 10 DS N \/S
If you wanted to sort your directories on the
10th of each month, this would be the
command. Again, after checking the internal
clock, the entire command, "DS N \/S" would
be passed to DOS if it was the 10th of the
Example 3: IfToday Even Chkdsk > Check
If you ran ChkDsk only on even days of the
month and redirected the output to a file
called "Check", this would do it.
Page 2 IFTODAY
I'm sure you get the idea. If there are any problems, just
drop by MidWest BBS and leave a note. We operate 24 hours a
day at baud rates up to 9600(HST).
Here's a list of commands IfToday understands:
Days of the Week: Sunday, Monday, Tuesday, Wednesday,
Thursday, Friday, Saturday, Sun, Mon, Tue,
Wed, Thu, Fri, Sat
Any Numerical day of the month : 1..31 (There's minimal leap
year logic built in).
Odd or Even Days of the month: Odd, Even
First or Last Day of the month: Begin, End, Beginning,
Ending, First, Last
Morning or Evening : AM, PM, P.M., A.M., Morning, Evening
Commands are NOT case sensitive.
11/15/90 - We've added a daily log of commands executed by
IFToday. The log file is called IFTODAY.LOG and is created in
the same directory as IFTODAY.EXE. This is a daily log, i.e.
only commands executed during one calendar day are logged. The
next day the file is erased and a new log created. It will
also log a failure to run due to an insufficient number of
12/12/90 - Several additional "whens" were also added - see
04/02/91 - Two approches have been added to prevent the
execution of commands within a single day or other time
period. The first, which is of limited usage, is the use of
an environment variable NOMORE. By using the command "SET
IFTODAY=NOMORE" you can prevent any action being taken by
IfToday. This is obviously no good after a reboot, but is
there for those that may find it useful. By the way, issuing
the command "SET IFTODAY=" will remove the environment
variable and allow IfToday to function normally.
The other method writes to a small file, which is maintained
in the same directory as IfToday.Exe, called IfToday.Tst. The
one and only entry in this file is the current date. If
IfToday finds this file and the date in the file matches the
current date, it will refuse to run. IfToday.Tst is created
by issuing the command "IFTODAY UPDATE" and will be erased
with the command "IFTODAY NOUPDATE". Conceptually, the last
command in a daily batch file would be the command to create
IfToday.Tst and any further attempts to use IfToday, that day,
would be prevented. The "NOUPDATE" parameter may be used to
release IfToday for further usage. It is not necessary to
erase IfToday.Tst prior to the issuance of the UPDATE command.
Page 3 IFTODAY
Something else which may not be immediately apparent is the
ability to run IfToday "recursively". For example "IFTODAY 5
IFTODAY UPDATE" would only create the update file on the 5th
of the month. Another example - " IFTODAY 1 IFTODAY MON
DOSOMETHING". DOSOMETHING would only execute on Moday the
first. This could be very useful in certain situations. As a
matter of fact, IFToday calls could be strung together up to
the limit of the DOS command line, although that might get a
little ridiculous. This does use an additional 40K of memory
with each recursion, as Command.Com is loaded each time, but
should present no problems for 1 or 2 iterations.
These new features require the use of DOS 3.0 or greater.
Attempts to run IFToday under a lesser version of DOS will not
One other obscure feature which was put in for a single need,
is the ability of IFToday to operate properly when it is named
something else. IfToday.Log and IfToday.Tst will still be
located in the directory where the executable program resides,
whatever it is called. Again, a limited use feature, but it
is available if needed.
IfToday is a copyright product of MidWest BBS. You are free
to use it in any fashion you choose. This includes both
personal and business environments. There is no charge.
If, however, you find this a useful program, gifts of $100,000
and up would be greatly appreciated and would certainly
encourage us to continue developing more trivial utilities.
We made a strong effort to ensure that this program works as
claimed, but will not be held liable for any damages, direct
or consequential, which result from the use of the program.
Use it at your own risk.