中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-11-11 08:29
47,815 topics / 349,930 posts / today 0 new / 48,291 members
DOS批处理 & 脚本技术(批处理室) » Please ask your specific question about the set delay variable so that I can provide the corresponding translation and relevant content.
Printable Version  7,349 / 25
Floor16 redtek Posted 2006-11-15 21:41
金牌会员 Posts 1,147 Credits 2,902
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 ]
Floor17 xue2ye Posted 2006-11-16 08:06
初级用户 Posts 11 Credits 26
Really thank you all great guys, I finally learned it. Hehe. I used to play with bat too, but generally only did some basic things. Not many things could be achieved. Now I can finally improve. Thanks. cn-dos. Thanks everyone.
Floor18 zh159 Posted 2006-11-16 10:50
金牌会员 Posts 1,467 Credits 3,687
set str=%str:www=bbs% Replace "www.cn-dos.net" with "bbs.cn-dos.net"
Floor19 scriptor Posted 2007-01-13 10:58
银牌会员 Posts 555 Credits 1,187
Got to know a little more. Solved my problem.
Floor20 stormback Posted 2007-01-19 05:06
新手上路 Posts 3 Credits 1
Floor21 jianyaogao Posted 2007-03-17 21:53
初级用户 Posts 22 Credits 49
Floor22 jianyaogao Posted 2007-03-18 00:32
初级用户 Posts 22 Credits 49
Floor23 godicozy Posted 2007-03-18 04:50
新手上路 Posts 5 Credits 10
Thank you for the poster's share
Floor24 moniuming Posted 2007-12-23 20:39
银牌会员 Posts 574 Credits 1,335 From 广西
Very detailed and specific, thank you very much!
Floor25 dai13910 Posted 2008-01-11 15:00
新手上路 Posts 5 Credits 10
redtek
So patient! A role model~!
Floor26 slw218856 Posted 2008-08-20 20:46
初级用户 Posts 75 Credits 133
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023