Current location - Training Enrollment Network - Mathematics courses - Usage of% in batch set
Usage of% in batch set
% is an escape character, which is usually translated into escape characters, but there are also more vivid translation escape characters and escape characters. In other words,% not only escapes and replaces a specific string associated with it, but also "escapes" itself. And similar to the escape character "\" in C language, double% will escape to single% and four% will escape to double%.

In addition to the for loop variable, the escape characters of batch variables should also be used in pairs, just like the brackets of four mathematical operations.

Call set b=%%a:~0, %c%%%

As far as your example is concerned, the innermost pair of single% is equivalent to brackets in four operations, the outermost pair of double% is equivalent to brackets, and the other 3% is equivalent to braces.