beautypg.com

How to set user variables in command files, How to set user variables in command files -7 – Gasboy CFN III Manager Manual V3.6 User Manual

Page 219

background image

MDE-4871 CFN III Manager’s Manual for Windows® XP Embedded - Version 3.6 · August 2010

Page 20-7

How to Use the IF Command

Advanced Command Files

How to Set User Variables in Command Files

The names %a through %z are user variables (a percent sign followed by an uppercase letter
is a system variable, discussed in the Making your own commands chapter). They are set with
the command SET_VAR or SET.

The full syntax of SET_VAR is:

Options: [;I] |
{variable {= | @ } [string] |
variable {+ | - | * | / | % | ^} number_value |
variable $ filename [line [column[length]]] |
variable ~ string [column [length]] |
variable ? filename |
variable # string}
variable < format number

Argument

Function

none

list contents of all variables

;I

deletes all variables

variable = string

sets variable equal to value (literal text, %
parameter number, or % variable name)

variable @ string

echoes string text as prompt, sets variable
equal to line typed by user

variable {+ | - | * | / | % | ^} number_value

sets variable to the result of performing the
given mathematical operation on the current
value of variable and number_value; % = mod,
^ = exclusive or

variable $ filename [line [column [length]]]

sets variable to the substring at location line
column
in filename, for length characters

variable ~ string [column [length]]

sets variable to string; if string is followed by a
blank space and a number, column, that number
is the offset into the string, from the left, before
the remainder of string will be set to variable;
(any blank spaces in the string itself must be
enclosed in quotation marks.); the second
number, length, if present, specifies how many
characters after the offset will be included in
variable

variable ? filename

sets variable to exact length in bytes of disk file
named by filename

variable # string

sets variable to length in characters of string

variable < format number

allows a number to be formatted into a user
variable using the same format options available
for the p1 option in EHCO. This is useful for
converting the internal format of numbers in
command files (which do not have decimal points
in them) into a form that can be used as input for
commands that require decimal points in the
correct place for different international formats.
For example, if the current international format is
USA:
set x < @M 12345
would place ‘123.45 into variable ‘x’.

This manual is related to the following products: