China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 06:49
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] Detailed Explanation of Variable Delay (Recommended for Beginners) View 24,464 Replies 111
Floor 16 Posted 2007-03-13 02:17 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
There are side effects. For example, it will discard the half-width exclamation mark in the variable value. Other side effects haven't been observed for the time being, and it remains to be discovered by you all.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 17 Posted 2007-03-13 03:45 ·  中国 广东 深圳 宝安区 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
Originally posted by namejm at 2007-3-13 02:17 AM:
  There are side effects, for example, it will discard the half-width exclamation mark in the variable value. Other side effects have not been observed for the time being, and it remains to be discovered by everyone.


Does it have a scope of action? If it is defined inside a for () loop, does it only work within the for () loop? If so, it can reduce some possible side effects.
Floor 18 Posted 2007-03-13 06:53 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
The meaning of setlocal is to localize variables. When it encounters the first endlocal statement, it ends this localization process. So, if defined inside for (), if the endlocal statement is not added in the appropriate position, the setlocal enabledelayedexpansion statement will always take effect.

In addition, more than 32 levels of setlocal statements will generate the error "The maximum setlocal recursion level has been reached". And one of the means to solve this problem is to use the endlocal statement to end the variable localization process before executing the 33rd setlocal statement.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 19 Posted 2007-03-13 15:28 ·  中国 福建 福州 电信
新手上路
Credits 12
Posts 6
Joined 2006-10-26 01:38
19-year member
UID 68281
Gender Male
Status Offline
It's very detailed. I kind of understand. Thank you~~~
Floor 20 Posted 2007-03-14 21:58 ·  中国 江苏 南京 电信
初级用户
Credits 76
Posts 39
Joined 2007-03-09 06:54
19-year member
UID 81169
Gender Male
Status Offline
LZ is very humorous, talked about a lot of things, and the moderator also supplemented a lot.........................
狐狸喜欢狡猾。。
Floor 21 Posted 2007-03-15 21:40 ·  中国 浙江 丽水 松阳县 电信
初级用户
Credits 39
Posts 20
Joined 2007-01-24 01:56
19-year member
UID 77471
Gender Male
Status Offline
Thanks a lot! Thanks to the original poster
Floor 22 Posted 2007-03-16 00:19 ·  中国 河南 郑州 电信
新手上路
Credits 17
Posts 8
Joined 2006-10-29 02:04
19-year member
UID 68718
Gender Male
Status Offline
Thanks
Floor 23 Posted 2007-03-16 23:20 ·  中国 广东 中山 电信
初级用户
Credits 128
Posts 16
Joined 2007-01-26 04:00
19-year member
UID 77697
Gender Male
Status Offline
Thanks for everyone's support. I just had time to stroll around here today. Hehe!
Special thanks to moderator namejm for guiding everyone. I also learned from it!!
Floor 24 Posted 2007-03-17 11:41 ·  中国 重庆 沙坪坝区 电信
社区乞丐
Credits -54
Posts 14
Joined 2007-01-03 10:04
19-year member
UID 75340
Gender Male
From 重庆大学
Status Offline
I finally figured it out today, haha! Thanks a lot!!!
太阳雨
Floor 25 Posted 2007-03-18 09:44 ·  中国 广东 东莞 电信
初级用户
Credits 76
Posts 30
Joined 2007-01-07 11:02
19-year member
UID 75718
Gender Male
Status Offline
Floor 26 Posted 2007-03-22 11:36 ·  中国 北京 昌平区 联通
中级用户
★★
菜鸟总动员
Credits 259
Posts 112
Joined 2006-08-28 15:53
19-year member
UID 61454
Status Offline
Your expression is so clear, really admire it~ Learn, learn!
Floor 27 Posted 2007-03-22 13:10 ·  中国 福建 泉州 石狮市 电信
银牌会员
★★★
Credits 1,276
Posts 469
Joined 2002-12-23 13:00
23-year member
UID 586
Gender Male
From 福建泉州
Status Offline
It's very good. I hope the original poster will write some similar articles to make it easier for newcomers to understand.
QQ:366840202
http://chenall.net
Floor 28 Posted 2007-03-24 01:23 ·  中国 广东 中山 电信
初级用户
Credits 128
Posts 16
Joined 2007-01-26 04:00
19-year member
UID 77697
Gender Male
Status Offline
Originally posted by chenall at 2007-3-22 12:10 AM:
It's very good. I hope the original poster will write some similar articles to make it easier for newcomers to understand.


I also hope I can, but it's just that I have more heart than strength (don't get me wrong~~heh)
Too busy! When I have time, I can only rest!
In fact, there are many experts in the forum. You can benefit a lot by asking any of them casually!
I will definitely write again when I have time! Actually, I'm also a noob!! Haha!
Floor 29 Posted 2007-03-26 08:36 ·  沙特阿拉伯
新手上路
Credits 10
Posts 5
Joined 2007-03-19 13:09
19-year member
UID 82252
Gender Male
Status Offline
These past two days I've been worrying about the command setlocal EnableDelayedExpansion, but today I saw your post and suddenly saw the light, thanks a lot.
Floor 30 Posted 2007-03-31 04:16 ·  中国 湖北 武汉 电信
中级用户
★★
scriptlover
Credits 328
Posts 131
Joined 2007-03-25 22:17
19-year member
UID 82910
Gender Male
Status Offline
Well done! Hope the thread starter posts more to let us newbies learn. (:)(:)
Forum Jump: