The reason for not understanding is: Trying to start reading from a command string mixed with (variable assignment, variable content replacement, variable display, how to display special symbols) and so on from the beginning :)
) Variable assignment: set str=www.cn-dos.net
) Variable content replacement: %str:www=bbs%
) Variable display: echo Execute set str=%%str:www=bbs%%
(%% represents displaying the % sign itself)
) Displaying special symbols: echo Execute set str=%%str:www=bbs%%
%% double percent signs represent displaying % itself (irrelevant to the value and processing), and the display result is: Execute set str=%str:www=bbs%
) ……
The following code is very simple (the reason it is called simple is: If you have learned all the basic knowledge, it is very simple)
The following code is also relatively difficult (the reason it is called relatively difficult is: If you don't look at the basic knowledge and start reading it like a program, there will always be things you don't understand)
It is suggested that brothers dshh98 and xue2ye start learning from the basic knowledge first, and you will become more and more handy ~:)
Batch processing is different from the learning points of C language or VB:
-----------------------------------
) C and VB, etc., all have function libraries (functions) that can be called. Whether it is file operation or string extraction, printing, etc., there are special function libraries to choose from.
) While batch processing is a collection of commands. Whether it is a DOS command or the Windows CMD Shell or calling system or third-party provided applications, etc....
The reason it is called "batch processing" is that you uniformly use the "batch processing" method to run those commands and assignment operations that you want to call and run ~:)
) "Batch processing" does not provide you with a way to call APIs or function libraries. The system (DOS or Windows) provides you with internal, external commands or applications, and you can call whatever is available.
For example: DIR is an internal command of the system, but DIR has many parameters... (it is not provided by batch processing)
According to personal understanding, an unofficial and non-standard explanation is: Batch processing is a collection of commands, which means putting many commands or programs in a script-written file and running them uniformly.
) So, the learning points of C or VB are grammar, function libraries, APIs...
) Learning points of batch processing: How deep you understand the internal commands or external commands provided by the operating system or third-party applications, and how deep you can use them.
(For example:) REG.EXE (CMD Shell), which operates on the registry.
REG has many execution parameters that can be selected. Batch processing applies it just by calling one of its parameters,
and putting it in the batch processing to be run together with other instructions.
(For example:) Format the command, which also has many parameters. It can be run directly or called to execute in this batch processing script file.
So, to use batch processing smoothly (for example: like the version master who can do whatever he wants to do),
you must thoroughly learn the basic knowledge such as variable assignment, variable content replacement, special symbols, escape (escape characters), etc. ~:)
And how deep you have learned these basic knowledge and how thoroughly you understand them means how smoothly you can complete your will ~:)
) If you study it like programming (like modern teaching methods: high-speed something like 24-hour quick success, something like from entry to proficiency learning methods), it simply won't work ~:)
In the end, you have to come back and learn these basic knowledge again ~:)
) It is suggested to start learning from the basics. (Batch processing depends on these basics, and you can't get anywhere without these basics)
==========================================
(An example is given)
"How to judge the length of a variable?"
If you use batch processing to calculate the length of the string contained in a variable (a variable that stores a string),
the system does not directly provide a function like C or VB to calculate the length of a string,
at this time, the algorithm and a large amount of experience in processing variables accumulated on weekdays tell you:
You should use different methods such as looping through individual variables and cumulative counting to cleverly achieve the above function ~:)
(The detailed example can be found at the following address:)
http://www.cn-dos.net/forum/viewthread.php?tid=24745&fpage=1
And these are not difficult. It still applies the basic knowledge such as variable assignment, looping, accumulation (also variable assignment), delayed variables...
So, you can't get anywhere without the basic knowledge ~:)
--------------------------------
Therefore, not starting to learn from the basic knowledge when learning batch processing is equal to learning in vain ~:)
[ Last edited by redtek on 2006-11-15 at 09:57 PM ]
) Variable assignment: set str=www.cn-dos.net
) Variable content replacement: %str:www=bbs%
) Variable display: echo Execute set str=%%str:www=bbs%%
(%% represents displaying the % sign itself)
) Displaying special symbols: echo Execute set str=%%str:www=bbs%%
%% double percent signs represent displaying % itself (irrelevant to the value and processing), and the display result is: Execute set str=%str:www=bbs%
) ……
The following code is very simple (the reason it is called simple is: If you have learned all the basic knowledge, it is very simple)
The following code is also relatively difficult (the reason it is called relatively difficult is: If you don't look at the basic knowledge and start reading it like a program, there will always be things you don't understand)
@echo off
set str=www.cn-dos.net
echo The content of variable str before replacement is: %str%
echo Execute set str=%%str:www=bbs%%
echo The content of variable str after replacement is: %str:www=bbs%
pause
It is suggested that brothers dshh98 and xue2ye start learning from the basic knowledge first, and you will become more and more handy ~:)
Batch processing is different from the learning points of C language or VB:
-----------------------------------
) C and VB, etc., all have function libraries (functions) that can be called. Whether it is file operation or string extraction, printing, etc., there are special function libraries to choose from.
) While batch processing is a collection of commands. Whether it is a DOS command or the Windows CMD Shell or calling system or third-party provided applications, etc....
The reason it is called "batch processing" is that you uniformly use the "batch processing" method to run those commands and assignment operations that you want to call and run ~:)
) "Batch processing" does not provide you with a way to call APIs or function libraries. The system (DOS or Windows) provides you with internal, external commands or applications, and you can call whatever is available.
For example: DIR is an internal command of the system, but DIR has many parameters... (it is not provided by batch processing)
According to personal understanding, an unofficial and non-standard explanation is: Batch processing is a collection of commands, which means putting many commands or programs in a script-written file and running them uniformly.
) So, the learning points of C or VB are grammar, function libraries, APIs...
) Learning points of batch processing: How deep you understand the internal commands or external commands provided by the operating system or third-party applications, and how deep you can use them.
(For example:) REG.EXE (CMD Shell), which operates on the registry.
REG has many execution parameters that can be selected. Batch processing applies it just by calling one of its parameters,
and putting it in the batch processing to be run together with other instructions.
(For example:) Format the command, which also has many parameters. It can be run directly or called to execute in this batch processing script file.
So, to use batch processing smoothly (for example: like the version master who can do whatever he wants to do),
you must thoroughly learn the basic knowledge such as variable assignment, variable content replacement, special symbols, escape (escape characters), etc. ~:)
And how deep you have learned these basic knowledge and how thoroughly you understand them means how smoothly you can complete your will ~:)
) If you study it like programming (like modern teaching methods: high-speed something like 24-hour quick success, something like from entry to proficiency learning methods), it simply won't work ~:)
In the end, you have to come back and learn these basic knowledge again ~:)
) It is suggested to start learning from the basics. (Batch processing depends on these basics, and you can't get anywhere without these basics)
==========================================
(An example is given)
"How to judge the length of a variable?"
If you use batch processing to calculate the length of the string contained in a variable (a variable that stores a string),
the system does not directly provide a function like C or VB to calculate the length of a string,
at this time, the algorithm and a large amount of experience in processing variables accumulated on weekdays tell you:
You should use different methods such as looping through individual variables and cumulative counting to cleverly achieve the above function ~:)
(The detailed example can be found at the following address:)
http://www.cn-dos.net/forum/viewthread.php?tid=24745&fpage=1
And these are not difficult. It still applies the basic knowledge such as variable assignment, looping, accumulation (also variable assignment), delayed variables...
So, you can't get anywhere without the basic knowledge ~:)
--------------------------------
Therefore, not starting to learn from the basic knowledge when learning batch processing is equal to learning in vain ~:)
[ Last edited by redtek on 2006-11-15 at 09:57 PM ]
Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._

