![]() |
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 05:59 |
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,408 / 49 |
| Floor16 PPdos | Posted 2008-06-25 21:15 |
| 高级用户 Posts 268 Credits 783 | |
Originally posted by qzwqzw at 2008-6-25 02:09 PM: What if it is written in one line? |
|
| Floor17 qzwqzw | Posted 2008-06-25 21:20 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Very tasteless idea. The code pursues simplicity and clarity rather than being short and strange.
|
|
| Floor18 metoo | Posted 2008-06-25 21:20 |
| 初级用户 Posts 93 Credits 195 | |
Originally posted by qzwqzw at 2008-6-25 09:09 PM: Brother seems to have insufficient understanding of what delay variables are. Similarly, the variable will naturally take effect after the for loop ends. Apply an example above without set/a It can be seen that the final variable %ww% will be assigned the last value |
|
| Floor19 PPdos | Posted 2008-06-25 21:30 |
| 高级用户 Posts 268 Credits 783 | |
Bland idea |
|
| Floor20 metoo | Posted 2008-06-25 21:30 |
| 初级用户 Posts 93 Credits 195 | |
Originally posted by qzwqzw at 2008-6-25 09:15 PM: Indeed. This format can be used.. Some of my code was also under-considered. I'm glad this forum can have such an atmosphere^ ^ |
|
| Floor21 qzwqzw | Posted 2008-06-25 21:31 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Brother metoo may have misquoted. I was refuting your remarks on the 15th floor.
My statement on the 13th floor was to prove that the code of the thread starter is redundant. It seems there is no problem. First, I am familiar with variable delay. The "delayed variable" is the first time I've seen it. What problem are you trying to illustrate with the example on the 18th floor? Any variable should naturally take effect as the last one after being "continuously assigned"? There's nothing to discuss about this. [ Last edited by qzwqzw on 2008-6-25 at 11:11 PM ] |
|
| Floor22 qzwqzw | Posted 2008-06-25 21:45 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
The weight of the content of the signature is greater than its appearance. The helplessness and openness revealed in it are what I very much appreciate. If there were no those finishing-off explanatory words, I would only regard it as something passing by. But many people are confused in the technical maze by that strange structure and a post of explanation by willsort, and instead lose the most precious inner part. Don't think that in the place where technology is discussed, one should get stuck in the technical details. After all, the discussion and development of technology are constantly bringing forth new things, while the feeling of the heart and the experience of life are often extremely precious.
|
|
| Floor23 metoo | Posted 2008-06-25 21:54 |
| 初级用户 Posts 93 Credits 195 | |
|
Actually, the original poster's statement is correct - -!
Then brother ppdos's simplification is actually wrong. It cannot replace the delayed variable, but is just the final product after simple consecutive assignments, and then I explained his that - -! Actually Whether it's called variable delay/delayed variable or whatever (of course 99% is that I called it wrong. Even a stubborn person has to be stubborn) The purpose of its existence is to get each step of the variable changes obtained by set in the for loop and then process them. When using set in for application, delayed variable is necessary. And using call is to put set in the outer circle of the loop command, which is a process of continuously calling sub - processes to achieve an effect similar to delayed variable. Also, the signature of "Helpless" is not consecutive assignment. Note that the set/p parameter is an interactive command. This place may be the most essential part of this signature. [ Last edited by metoo on 2008-6-25 at 09:56 PM ] |
|
| Floor24 PPdos | Posted 2008-06-25 21:58 |
| 高级用户 Posts 268 Credits 783 | |
|
Everyone didn't say the building owner was wrong~~?
I just think the building owner wrote it a bit long and simplified it a bit Whether it's wrong or not is still a matter of personal opinion |
|
| Floor25 wxcute | Posted 2008-06-25 22:16 |
| 中级用户 Posts 211 Credits 458 | |
|
I didn't expect so many people to discuss.
Just like what qzwqzw on floor 15 of page 1 said, changing it like this can display the middle one. Also, "metoo" is quite funny, "stubborn dead duck" [ Last edited by wxcute on 2008-6-25 at 10:25 PM ] |
|
| Floor26 qzwqzw | Posted 2008-06-25 22:21 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
First of all, the LZ's statement is definitely correct. Calculations can certainly be done without variable delays (even in a for loop). Of course, the "calculation" here is very vague, leading to everyone having their own understanding. The implied meaning here by the LZ is that call can be used instead of delay because call appears in his code. Secondly, the LZ's code is also correct, with correct syntax and achieving the desired effect. What I want to show is that the LZ's code cannot prove the implied meaning in his view because I can achieve the same purpose in a non-call and non-delay way, so there is no way to explain the significance of call replacing delay. -------------------------------------------------------- From the first reply of ppdos, it is known that he understands the default delay effect of set /a I mentioned in building 14, but just didn't connect it with the LZ's statement as a problem. Simplification itself is not a problem, and I just think that condensing into one line of code is a bit redundant. One can also find evidence to prove the view that call can replace delay. (for /f %i in ('dir /b') do set /a n+=1 >nul)&call echo There are %n% files(folders) under the directory can be replaced by (for /f %i in ('dir /b') do set /a n+=1 >nul)&echo There are!n! files(folders) under the directory. This shows that when encountering variable delay problems in the connected statements, call can be used to replace, while metoo looks into the for, of course, not seeing anything valuable. -------------------------------------------------------- As for the signature of Wunaaihe, that's really off-topic. I only remember those few lines of words now, and the code has long been forgotten completely, and I don't bother to dig it out again, and just let it be whether it's continuous assignment or not. [ Last edited by qzwqzw on 2008-6-25 at 10:28 PM ]
|
|
| Floor27 metoo | Posted 2008-06-25 22:27 |
| 初级用户 Posts 93 Credits 195 | |
|
The author's method is correct.. But that simplified version can't replace the delay variable.. I have realized this mistake.. Say, the moderator's case is a special situation, not continuously assigning values.. Using the interactive way of set/p.. That call is not used in this way.. I imitated his signature to write a p version
According to the above statement, then what kind of explanation is my call call? [ Last edited by metoo on 2008-6-25 at 10:40 PM ] |
|
| Floor28 wxcute | Posted 2008-06-25 22:30 |
| 中级用户 Posts 211 Credits 458 | |
|
Actually, I'm also just a newbie, and I didn't think that deeply.
I'm just used to using %, and it's a bit uncomfortable to replace % with!, and also writing "setlocal enableDelayedExpansion" is quite tedious. I have a bad memory, and it took me some time to remember it. |
|
| Floor29 metoo | Posted 2008-06-25 22:33 |
| 初级用户 Posts 93 Credits 195 | |
Originally posted by wxcute at 2008-6-25 10:30 PM: I'm also a newbie, to be honest, I can't remember this stuff now. I set up a shortcut input! in editplus! |
|
| Floor30 qzwqzw | Posted 2008-06-25 22:38 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
It gets a bit chaotic when there are too many people.
Plus there are a few who like to edit posts. After looking at it for a while, I just can't follow the train of thought. Now let's sort it out. ppdos initially just wanted to simplify the LZ's code. Then it was proposed that Wunaaihe's signature was a refutation of my statement "short and weird is not可取". metoo wanted to explain the meaning of "continuous assignment" of variable delay and use that to prove its irreplaceable nature. Later it was mentioned that Wunaaihe's signature didn't use variable delay because it didn't use "continuous assignment". I initially just wanted to say that the LZ's code couldn't prove the LZ's viewpoint. Now I want to extend the LZ's viewpoint — for+call can replace for+delay, in any case. Everyone is welcome to come up with examples to refute my viewpoint. By the way, it's also a sort-out of my own programming ideas and code skills. |
|
| Prev 1 2 3 4 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |