Purpose:Monitor the current date and time

 

Format:DATEMONITOR [/C [yyyy-mm-dd hh:mm]]

DATEMONITOR yyyy-m-dd hh:mm n command

 

nNumber of repetitions (or FOREVER)
yyyy-mm-ddThe date to match
hh:mmThe time to match
commandCommand to execute when the specified date and time matches the current date and time

 

/C(lear)

 

Usage:

 

DATEMONITOR monitors the current date and time, and executes the specified command when the current date and time match the saved date and time. You can use a * in the date fields if you want to run a command at a specific time every day. For example:

 

datemonitor *-*-* 23:59 forever echo It's almost midnight!

 

If you want to run a command on the first day of every month:

 

datemonitor *-*-1 00:01 forever echo It's the beginning of a new month!

 

If you don't enter any arguments, if DATEMONITOR is active it will display the repeat count and the command.

 

DATEMONITOR sets two environment variables when the date and time match and the trigger is set:

 

_datemonitorThe current date in yyyy-mm-dd format

 

_timemonitorThe current time in hh:mm (24-hour) format

 

The command line will be parsed and expanded before DATEMONITOR is executed, so if you want to pass redirection characters or variables to command you will need to protect them (by enclosing in single back quotes, doubling the %'s, or using command grouping).

 

If the last argument on the line is a single (, it is interpreted as the beginning of a command group. DATEMONITOR will append the following lines (in a batch file) or prompt you for more input (at the command line) until it gets a closing ).

 

The monitoring runs asynchronously in a separate thread. When the condition is triggered, the command will be executed immediately. This may cause problems if you try to write to the display or access files while the main TCC-RT thread is also performing I/O. You may need to use START or DETACH in command to avoid conflicts.

 

Options:

 

/CRemove date monitors. You can optionally specify a specific date monitor to remove by entering the date and time (which may include wildcards) for that monitor.