![]() |
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-10-01 06:26 |
47,813 topics / 349,918 posts / today 0 new / 48,279 members |
| DOS批处理 & 脚本技术(批处理室) » It can also be calculated without using variable delay [setlocal enableDelayedExpansion] |
| Printable Version 5,410 / 49 |
| Floor1 wxcute | Posted 2008-06-24 22:20 |
| 中级用户 Posts 211 Credits 458 | |
|
Maybe everyone knows, for those who don't know, let's learn.
It can also be used in other places. |
|
| Floor2 HAT | Posted 2008-06-24 22:36 |
| 版主 Posts 5,017 Credits 9,023 | |
|
I don't know, learning.
|
|
| Floor3 lxmxn | Posted 2008-06-24 22:55 |
| 版主 Posts 4,938 Credits 11,386 | |
Originally posted by HAT at 2008-6-24 22:36: Orz …… |
|
| Floor4 PPdos | Posted 2008-06-24 22:56 |
| 高级用户 Posts 268 Credits 783 | |
|
This is also the role of call
|
|
| Floor5 wxcute | Posted 2008-06-25 18:59 |
| 中级用户 Posts 211 Credits 458 | |
|
The usage seen on the 4th floor is another new one I've encountered.
|
|
| Floor6 PPdos | Posted 2008-06-25 19:03 |
| 高级用户 Posts 268 Credits 783 | |
|
This is no different from the original poster's, just simplified a bit
|
|
| Floor7 wxcute | Posted 2008-06-25 19:07 |
| 中级用户 Posts 211 Credits 458 | |
|
But I'm a newbie, and I find such usage a bit strange and not very used to it. Still, I need to learn more from you all.
|
|
| Floor8 radem | Posted 2008-06-25 19:07 |
| 高级用户 Posts 383 Credits 691 | |
| Floor9 metoo | Posted 2008-06-25 19:22 |
| 初级用户 Posts 93 Credits 195 | |
|
This kind of thing can't replace the delayed variable. They all display the final effect after completely ending a for + set loop, and can't use intermediate links at all. The role of the delayed variable is to use the intermediate results of set.
The above two are the same as the building owner and the above ppdos code, and can't use intermediate results. You can compare the results. [ Last edited by metoo on 2008-6-25 at 07:26 PM ] |
|
| Floor10 PPdos | Posted 2008-06-25 19:51 |
| 高级用户 Posts 268 Credits 783 | |
|
If you want to use the intermediate result, it's also okay.
[ Last edited by PPdos on 2008-6-25 at 01:01 PM ] |
|
| Floor11 metoo | Posted 2008-06-25 20:40 |
| 初级用户 Posts 93 Credits 195 | |
|
This is a clever way. It uses consecutive multi-variable assignments respectively to obtain the value of one of the intermediate variables, rather than directly obtaining it through true consecutive assignment/intermediate links. It defines n variables to stepize the entire for loop, and these stepized results can only be used after the entire loop ends.
[ Last edited by metoo on 2008-6-25 at 08:42 PM ] |
|
| Floor12 PPdos | Posted 2008-06-25 20:49 |
| 高级用户 Posts 268 Credits 783 | |
Originally posted by metoo at 2008-6-25 01:40 PM: Can the expert give an example? |
|
| Floor13 qzwqzw | Posted 2008-06-25 21:09 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Have everyone been talking for a long time and not realized that they are discussing around a very non-typical example? Doesn't anyone know that set /a has the default delay effect? The example of the LZ completely doesn't need variable delay or "intermediate results" and so on.
|
|
| Floor14 metoo | Posted 2008-06-25 21:12 |
| 初级用户 Posts 93 Credits 195 | |
|
- Just a beginner
Your approach is to obtain each step by "changing variables", which is to generate n different variables at one time. These variables can only be used after the for command has completely executed. This is what I call taking a shortcut. While delayed expansion allows using variables during the execution of the for command. [ Last edited by metoo on 2008-6-25 at 09:14 PM ] |
|
| Floor15 qzwqzw | Posted 2008-06-25 21:15 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Brother metoo's remarks on floor 9 are a bit thoughtless.
In the DOS era without variable delay, it is also possible to "assign continuously / directly obtain in the intermediate link". This only needs to make some small changes to the :num_add section that is called. And the scheme of using for + call instead of for + delay usually transfers all the loop body code to the called subroutine, and there are no restrictions inside the subroutine, where you can use it as you like. |
|
| 1 2 3 4 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |