|
Answer» There is needed for an auto-incrementing version number in my software build process. I want to place the version number(like 2.0.3.6) in a .txt file, and the txt file just has one row. Now i want to know whether it can plus two numbers in DOS and return result? Thinks! Use help SET I have extracted the relevant part below
SET /A expression The /A switch specifies that the STRING to the right of the equal sign is a numerical expression that is evaluated. The expression EVALUATOR is pretty simple and supports the following operations, in decreasing order of precedence:
() - grouping ! ~ - - unary operators * / % - arithmetic operators + - - arithmetic operators << >> - logical shift & - bitwise and ^ - bitwise exclusive or | - bitwise or = *= /= %= += -= - assignment &= ^= |= <<= >>= , - expression separator
If you use any of the logical or modulus operators, you will need to enclose the expression string in quotes. Any non-numeric strings in the expression are treated as environment variable names whose values are converted to numbers before using them. If an environment variable name is specified but is not defined in the current environment, then a value of zero is used. This allows you to do arithmetic with environment variable values without having to type all those % signs to get their values. If SET /A is executed from the command line outside of a command script, then it displays the final value of the expression. The assignment operator requires an environment variable name to the left of the assignment operator. Numeric values are decimal numbers, unless prefixed by 0x for hexadecimal numbers, and 0 for octal numbers. So 0x12 is the same as 18 is the same as 022. Please note that the octal notation can be confusing: 08 and 09 are not valid numbers because 8 and 9 are not valid octal digits.
Graham
|