This is not an answer, but a great comment in response to dbenham's answer.
My point of view on this issue is completely opposite to the point of view of Dbenhams. In my opinion, in the answers to Batch topics we should be very concise and clear, especially with beginners, and provide minimal information that helps solve the problem, but does not overload or confuse the answers. There are two ways to simulate arrays in batch mode: through commonly used square brackets to enclose a subscript or not, but in both cases the concept is the same: select a specific element from the list of variables with the same name using a numerical index.,
If square brackets are not used, the beginner will not understand the basic concept; instead, they might think that the batch file used a “strange trick” to solve the problem. An experienced programmer, on the other hand, will probably say: "Hey! This is an array, but written differently." There is no way to take this feature for any other thing, and there is no reason to disguise it as another thing.
If square brackets are used, the beginner will find a lot of information about the concept of "array" and many examples on this topic in many programming languages, and even descriptions independent of any programming language, which, of course, are immediately used in batch files., Using square brackets in this case, it is much clearer than not doing it. However, some people feel that these benefits are not worth the "confusion" with the assumption that Batch "formally supports arrays."
In my opinion, the central question in this matter is not a discussion of whether the package formally supports arrays or not, but that anyone can use the concept of an array to manipulate data in batch files. I don't see any problems with the possibility that some people think that Batch supports arrays correctly, especially for beginners; Array management in different programming languages is different, so you just need to explain the package details. However, if a more formal discussion of this issue seems more important, I would like to give another example.
Did you know that the C programming language DOES NOT “formally support” any input / output operations? When Dennis Ritchie developed it, he deliberately left these operations outside the language design so that the compiler would be small and compact. Does this mean that you cannot read / write any data in C programs? Of course not! It just means that these operations are implemented outside the compiler through function libraries, so if you need to develop a C compiler, you don’t have to worry about how to compile PRINT, READ or any other I / O statement, because they simply do not exist on C language!
Interesting, isn't it?
Therefore, if a beginner asks: “How to write a message in C?”, You think the correct answer should be: “You cannot. C does not formally support any I / O statement, but you can emulate such operations through library functions "? Of course not! Most people would simply answer by describing printf, but almost no one has mentioned that printf () is NOT part of the C language, and I think that is correct. Ultimately, what is the problem if someone might think that C supports I / O? People can use I / O in C programs no matter how they were implemented, right?
Well, in my humble opinion, the same approach should be used with arrays in Batch.
Perhaps a closer example is this: there are many questions about “arithmetic operations in batch mode”, and the answer is usually: “use the set/A command”. I have never seen an answer indicating that "Batch files do not support numeric variables, only strings, but arithmetic operations can be emulated in several ways, for example, with the set/A command." What for? Purists seem to be "more purists" when they express an opinion on arrays in Batch, but they don't care about other topics, such as numbers. I really don't understand the purpose of frequently clarifying that "the package does not support arrays"!
Rojo has commented on this:
This is a pedantic argument that does not offer a solution to the problems that askers are trying to solve.
(see his full comment above this answer ).