Working with Environment Variables

nnCron LITE can define local environment variables right in a crontab file. Local environment variables (i. e. variables available only to application started by nnCron LITE) are defined with word SET.

# local environment variable
SET varname=string value until the end of line # or SET varname="string value"

Environment variables defined in a crontab are totally independent of the system, and this is their main advantage. For example, in Windows NT/2000/XP, nnCron LITE is run by SYSTEM, and variables of "user" SYSTEM may be different from variables set for a current user. But if the variables are defined in crontabs, they are not affected by this problem and you won't have reenter them after reinstalling your system.

Local environment variables are reloaded, (in other words, re-set) each time any program is started by nnCron. This allows a user to set values which are difficult to set with the standard means provided by a command interpreter. For example, date, time or another changing factor can be set as an environment variable:

SET CURTIME=%hh%:%mm%

Please note that values of variables are "calculated" right at the moment when they are addressed, so it would be not a good idea to use constructs like the one below:

SET PATH="%PATH%;c:\xxx"

it will cause the value of PATH become longer and longer each time PATH is addressed.