Previous Topic: Execute Batch File

Next Topic: Using Special XML Characters in Batch Files

Using Variables in Batch

While using CA RCM in production and utilizing batch processing, you may need to specify dynamic parameters for file names that are defined in the SBT files.

For example:

Instead of writing CONFIG="AD_Config.cfg", you may prefer that the file name have the date and time. If this is the case it is important to specify this in the file name as a variable. This way each time to you run the Batch file the file name will automatically be updated with the new time and date in the name.

Example:

<BATCH>
<COMMAND
ACTION="IMPORT CSV"
ROLEID_AS_NUM="true"
CONFIG="Config_%%DATE%%_%%TIME%%_%%USERNAME%%.cfg"
USERS_DB="UsersDB.udb"
RES_DB="ResDB.rdb"
ROLE="roles.txt"
USER_RES="user-res.txt"
USER_ROLE="user_role.txt"
ROLE_RES="role_res.txt"
ROLE_ROLE="role_role.txt"/>
</BATCH>

File name variables in the SBT files are converted/replaced when the SBT file is executed.

A variable is defined as a keyword surrounded by %% and %%.

Example: %%DATE%%

Supported variables:

Variable Name

Output format

Any user environment variable

The parameter's value

Example:

If HOME= C:\HOME

%%HOME%% will be replaced with C:\HOME

%%DATE%%

YYYYMMDD

%%TIME%%

HHMM