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-23 01:38
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] COLOR TIME Color Time Screen Saver View 10,222 Replies 47
Floor 16 Posted 2007-01-29 03:27 ·  美国 缅因州
中级用户
★★
Credits 316
Posts 152
Joined 2006-06-18 13:01
20-year member
UID 57204
Gender Male
Status Offline
The processing has reached such a level, really an outstanding person! Take it down and savor it slowly
Floor 17 Posted 2007-01-29 14:31 ·  中国 广东 广州 中移铁通
中级用户
★★
Credits 256
Posts 93
Joined 2006-03-26 22:12
20-year member
UID 52853
Gender Male
From 广东
Status Offline
The effect of removing call is the same.

The role of call is sometimes very big.

@echo off
set a=1
echo %a%
call :aa a
echo %a%
goto :EOF

:aa
call set %1=2
goto :EOF
Floor 18 Posted 2007-01-29 15:01 ·  中国 江西 南昌 电信
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
The first sentence call is the job content

The second sentence call is an unnecessary addition

set %1=2

And

call set %1=2

The results are not different

In the following example call is useful


@echo off
set a=1 2 3
echo %a%
call :aa a
echo %a%
goto :EOF

:aa
call set %1=%%%1%% 4 5 6
goto :EOF


[ Last edited by qzwqzw on 2007-1-29 at 02:03 AM ]
Floor 19 Posted 2007-01-29 15:18 ·  中国 山东 济南 电信
初级用户
Credits 125
Posts 44
Joined 2007-01-24 15:31
19-year member
UID 77555
Gender Female
Status Offline
Please clarify your request. Are you asking for a translation of this Chinese text into English as per the given requirements? If so, here is the translation:

请问 qzwqzw :

1.---------------------------
call set %1=%%%1%% 4 5 6

Before the code is tested and run, how to determine how many % symbols to use.

2.---------------------------
call set %1=%%%1%% 4 5 6 is equivalent to set %1=%a% 4 5 6

Is there a necessity for call set.

[ Last edited by qjbm on 2007-1-29 at 02:23 AM ]
Floor 20 Posted 2007-01-29 15:19 ·  中国 广东 广州 花都区 电信
初级用户
★★
Credits 197
Posts 77
Joined 2006-09-19 14:02
19-year member
UID 63074
Gender Male
Status Offline
Wow~~~~~Pretty impressive, though I didn't understand it.... Sweat~~
Floor 21 Posted 2007-01-29 15:22 ·  中国 广东 广州 中移铁通
中级用户
★★
Credits 256
Posts 93
Joined 2006-03-26 22:12
20-year member
UID 52853
Gender Male
From 广东
Status Offline
Add another pair of %%

call set %1=%%%1%% 4 5 6

call set a=%%a%% 4 5 6
  ↓
set a=%a% 4 5 6
Floor 22 Posted 2007-01-29 15:51 ·  美国 弗吉尼亚州 梅克伦堡县 博伊顿 Microsoft
高级用户
★★
Credits 783
Posts 268
Joined 2006-12-26 17:18
19-year member
UID 74627
Gender Male
Status Offline
@echo off
set a=1 2 3
echo %a%
call :aa a
echo %a%
goto :EOF

:aa
call set %1=%%%1%% 4 5 6
goto :EOF


The understanding is good. To a certain extent, the role of call is to substitute variable delay

@echo off
setlocal enabledelayedexpansion
set a=1 2 3
echo %a%
call :aa a
echo %a%
pause
goto :EOF

:aa
set %1=!%1! 4 5 6
goto :EOF
菩提本无树,明镜亦非台,本来无一物,何处惹尘埃.
Floor 23 Posted 2007-01-30 00:41 ·  中国 山西 运城 联通
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
---qjbm-----------

Q1: The general principle is that you use as many % as the number of times you need to parse.

For example, call set %1=%%%1%% 4 5 6

Before the call is executed, the command line has been processed into a form like this:

call set a=%a% 4 5 6

After the call is executed and before the set is executed, the command line becomes like this:

set a=1 2 3 4 5 6

Q2: When the variable name used in the aa segment is uncertain or dynamically changing, call set is useful.

---PPdos----------------------------------

Understood well.

But it is more appropriate to understand it the other way around -

The role of variable delay l is to a certain extent to replace call.

Because the usage of call appeared much earlier.

Before there was cmd.

In DOS, call was used to implement the pass-by-reference feature similar to C language.
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
NWQ +1 2007-01-30 00:47
qjbm +1 2007-01-30 03:38
Floor 24 Posted 2007-01-30 05:22 ·  中国 湖北 武汉 蔡甸区 电信
初级用户
Credits 36
Posts 18
Joined 2007-01-30 02:39
19-year member
UID 78074
Gender Male
Status Offline
Great, collect it and study it slowly~~~~~~
Floor 25 Posted 2007-01-30 12:06 ·  中国 北京 朝阳区 联通
高级用户
★★
朦胧的世界
Credits 579
Posts 218
Joined 2006-10-24 04:29
19-year member
UID 67972
Status Offline
The creativity is quite good. Just there are too many unnecessary sentences. Simplify it.


@echo off & setlocal EnableDelayedExpansion
mode con cols=100 lines=40
title COLOR TIME
call :tnb
set spc=
set font=█★●◆□◎◇¤⊙〓

:new
setlocal
color e%RANDOM:~-1%
set rdfont=!font:~%RANDOM:~-1%,1!
set/a a=%random%%%50,b=%random%%%35
set nk=!spc:~0,%a%!
for /l %%a in (0,1,%b%) do echo.
if "%time:~0,1%"==" " set time=0%time:~1%

echo %nk% %date%
echo %nk% !%time:~0,1%a:█=%rdfont%! !%time:~1,1%a:█=%rdfont%! !%time:~3,1%a:█=%rdfont%! !%time:~4,1%a:█=%rdfont%!
echo %nk% !%time:~0,1%b:█=%rdfont%! !%time:~1,1%b:█=%rdfont%! !%time:~3,1%b:█=%rdfont%! !%time:~4,1%b:█=%rdfont%!
echo %nk% !%time:~0,1%c:█=%rdfont%! !%time:~1,1%c:█=%rdfont%! · !%time:~3,1%c:█=%rdfont%! !%time:~4,1%c:█=%rdfont%!
echo %nk% !%time:~0,1%d:█=%rdfont%! !%time:~1,1%d:█=%rdfont%! !%time:~3,1%d:█=%rdfont%! !%time:~4,1%d:█=%rdfont%!
echo %nk% !%time:~0,1%e:█=%rdfont%! !%time:~1,1%e:█=%rdfont%! · !%time:~3,1%e:█=%rdfont%! !%time:~4,1%e:█=%rdfont%!
echo %nk% www.cn-dos.net DOSCC WINBY.
ping 127.1 -n 3 >NUL
cls
endlocal
goto :new

:tnb
rem 0-9 digital appearance.
set 0a=█████
set 0b=█ █
set 0c=█ █
set 0d=█ █
set 0e=█████

set 1a= ██
set 1b= █
set 1c= █
set 1d= █
set 1e= █

set 2a= ███
set 2b= █
set 2c=█████
set 2d=█
set 2e=█████

set 3a= ███
set 3b= █
set 3c=█████
set 3d= █
set 3e=█████

set 4a=█
set 4b=█ █
set 4c=█████
set 4d= █
set 4e= █

set 5a=███
set 5b=█
set 5c=█████
set 5d= █
set 5e=█████

set 6a=███
set 6b=█
set 6c=█████
set 6d=█ █
set 6e=█████

set 7a=█████
set 7b=█ █
set 7c= █
set 7d= █
set 7e= █

set 8a=█████
set 8b=█ █
set 8c=█████
set 8d=█ █
set 8e=█████

set 9a=█████
set 9b=█ █
set 9c=█████
set 9d= █
set 9e= ████
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
electronixtar +8 2007-01-30 14:05

认识自己,降伏自己,改变自己
,才能改变别人!
Floor 26 Posted 2007-01-30 12:50 ·  中国 北京 中国科学院研究生院
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
I'm really佩服 you guys.

Haha...
Floor 27 Posted 2007-01-30 12:51 ·  中国 北京 中国科学院研究生院
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
Haven't been here to post for a long time.

Saw a lot of good things today.

Studying intensively right now.

*_*
Floor 28 Posted 2007-01-31 00:22 ·  中国 湖南 联通数据上网公共出口
社区乞丐
★★
gaoshou
Credits -16
Posts 77
Joined 2007-01-30 09:11
19-year member
UID 78105
Gender Male
Status Offline
:cool:
Floor 29 Posted 2007-01-31 11:00 ·  中国 湖南 衡阳 电信
中级用户
★★
Credits 322
Posts 144
Joined 2007-01-10 13:00
19-year member
UID 76062
Gender Male
Status Offline
The handwriting of the numbers is not very nice.
Floor 30 Posted 2007-02-01 00:53 ·  中国 湖南 长沙 联通
社区乞丐
★★
gaoshou
Credits -16
Posts 77
Joined 2007-01-30 09:11
19-year member
UID 78105
Gender Male
Status Offline
Top.............
But I always feel something is missing
:cool:
Forum Jump: