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 08:15
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] Detailed Explanation of Variable Delay (Recommended for Beginners) View 24,479 Replies 111
Floor 76 Posted 2008-02-19 12:20 ·  中国 上海 浦东新区 电信
新手上路
Credits 13
Posts 7
Joined 2007-10-19 11:22
18-year member
UID 100140
Gender Male
Status Offline
Really learned a lot, also read the post of will Sort. Good stuff, this time I finally understand the variable expansion. Thanks
Floor 77 Posted 2008-03-11 10:46 ·  中国 黑龙江 鸡西 虎林市 联通
初级用户
Credits 25
Posts 14
Joined 2006-11-02 01:05
19-year member
UID 69226
Gender Male
Status Offline
The building owner has worked hard. This post is very useful for newbies like us, and we must support it a little bit.
Floor 78 Posted 2008-03-11 10:48 ·  中国 山东 济南 联通
高级用户
★★★
Credits 959
Posts 474
Joined 2007-10-25 10:40
18-year member
UID 100716
Gender Male
Status Offline
Collected, thank you, the landlord
Floor 79 Posted 2008-03-11 11:06 ·  中国 湖南 株洲 电信
金牌会员
★★★★
永远的学习者
Credits 3,105
Posts 1,276
Joined 2008-03-08 13:00
18-year member
UID 112398
Gender Male
Status Offline
Originally posted by willsion at 2007-3-13 01:44:
Additionally, there is a question. I don't know if variable delay has side effects. If there are no side effects, then every program header can simply insert the setlocal EnableDelayedExpansion statement. Just like @echo off.

It should have side effects. I encountered it once when writing code (it was a mistake made by myself). As follows:
:begin
@echo off&setlocal EnableDelayedExpansion
.........................................
........................................
..........................................
goto begin
Originally, :begin was supposed to be placed after '@echo off&setlocal EnableDelayedExpansion'. But after running for a while, it always displayed that the setlocal had reached the maximum limit (I can't remember the original text). The variable delay in P also had errors and became invalid. Due to my limited level, I will stop here for narration. Everyone is welcome to express their opinions. The purpose is to learn and improve together.
Floor 80 Posted 2008-03-18 19:53 ·  中国 广东 广州 番禺区 电信
中级用户
★★
Credits 233
Posts 117
Joined 2007-11-28 02:38
18-year member
UID 104005
Gender Male
Status Offline
Thanks to the LZ, after reading your post, I've learned a lot more.
Floor 81 Posted 2008-03-19 19:01 ·  中国 北京 电信
初级用户
Credits 28
Posts 12
Joined 2007-05-08 17:43
19-year member
UID 87879
Gender Male
Status Offline
Just solved my current problem:) Thank you. Previously, in the for, I used set /a n=%%f set /a m=n/16 set /a o=n%16... and couldn't get the correct result, but now it's fixed:)
Floor 82 Posted 2008-04-09 23:37 ·  中国 湖北 武汉 电信
新手上路
Credits 2
Posts 1
Joined 2008-04-09 21:24
18-year member
UID 115409
Gender Male
Status Offline
Good stuff
Floor 83 Posted 2008-04-10 14:36 ·  日本
新手上路
Credits 12
Posts 6
Joined 2008-02-21 22:25
18-year member
UID 111169
Gender Male
Status Offline
Floor 84 Posted 2008-04-11 10:41 ·  中国 四川 内江 电信
初级用户
★★
Credits 120
Posts 62
Joined 2008-04-11 09:52
18-year member
UID 115566
Gender Male
From 四川内江
Status Offline
Thanks to the moderator, I seem to understand a little! I don't know if it means that those delays make echo and other assignment statements effective, and the assignment can be completed without being affected by the running commands of cmd! Still hope the moderator can give some guidance!
Floor 85 Posted 2008-04-11 13:59 ·  中国 江苏 无锡 电信
新手上路
Credits 14
Posts 7
Joined 2006-06-28 20:48
19-year member
UID 57710
Status Offline
Newcomer, not bad. Thanks
Floor 86 Posted 2008-05-06 23:50 ·  中国 广西 南宁 电信
中级用户
★★
丶杏灬丶
Credits 280
Posts 105
Joined 2008-05-06 03:37
18-year member
UID 117858
Gender Male
From 广西
Status Offline
I've been wandering in confusion~~ Now I can finally find my way out~~~
So classic~~
Thanks a lot
Floor 87 Posted 2008-05-07 18:22 ·  中国 辽宁 锦州 电信
初级用户
Credits 64
Posts 46
Joined 2008-04-21 14:54
18-year member
UID 116504
Gender Male
Status Offline
Thank you very much, the original poster!

The explanation is very clear, hard work, hard work~~~
Floor 88 Posted 2008-05-23 16:15 ·  中国 上海 电信
初级用户
★★
Credits 160
Posts 81
Joined 2006-07-27 17:52
19-year member
UID 59377
Gender Male
Status Offline
Thank you very much, the problem that troubled me for 2 days has finally been solved. Also, thank you to the forum.
Floor 89 Posted 2008-05-28 00:36 ·  中国 江苏 苏州 电信
初级用户
★★
Credits 161
Posts 87
Joined 2008-05-25 17:25
18-year member
UID 119673
Gender Male
Status Offline
Floor 90 Posted 2008-07-11 14:36 ·  中国 广东 东莞 电信
初级用户
Credits 60
Posts 34
Joined 2007-04-24 02:13
19-year member
UID 86232
Gender Male
Status Offline
===I need to look at it for a while to get a bit...
Forum Jump: