I have been learning batch processing for some time. I feel that batch processing scripts have many things in common with many programming languages, especially in algorithms. The algorithms from other programming languages can also be applied to batch processing. Of course, it is only the similarity in algorithms, and the actual statements are different. ^_^
In my personal opinion, batch processing scripts have the following aspects in common with other programming languages (compared with the familiar C language):
--------------------------------------- Variable assignment
In batch processing, you can use the set command to assign values, while in C language, it is assigned like "int a=1".
Judgment statement
In batch processing, you can use if to judge, and similarly, in C language, you also use if.
Loop statement
In batch processing scripts, you can use for to implement the loop function (of course, there are many other methods to implement loops in batch processing~), which is similar to the for in C.
Input statement
In C language, you can use the "Scanf()" function to implement input operations, while in batch processing, you can use "set /p a=" instead.
Output statement
In C language, you can use the "Printf()" function to implement output operations, and in batch processing, you can use a simple "echo" statement to complete it.
Function
In C language, you can call functions to directly complete some tasks. I think that the combination of the "call" and "goto" commands in batch processing with labels is equivalent to a "function". You can first write the functions to be implemented in batch processing, then save the code in a.bat file or.cmd file, or directly put it in the batch processing script that calls it, and then call it with "call" or "goto", which is not equivalent to a function? =_=
Parameter
In C language, there are parameters, and batch processing files and commands can also accept various parameters.
Algorithm
Many algorithms are similar.
---------------------------------------
The above are just my humble opinions. Due to experience and various reasons, there are inevitable omissions and errors. Everyone is welcome to discuss, criticize, and correct. If there are other common points that I haven't mentioned, everyone can post to discuss, and I will improve the content of the original text.
Maybe some friends think that one is a script and the other is a programming language, and the two cannot be compared. And the purpose of me writing this article is to make everyone have a new understanding of batch processing, that's all.
[ Last edited by lxmxn on 2006-11-16 at 03:34 AM ]
Recent Ratings for This Post
( 1 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| redtek | +3 | 2006-11-16 03:35 |

