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-30 19:28
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Asking Willsort and all brothers about prompt _$T$_ View 1,610 Replies 8
Original Poster Posted 2006-11-22 10:16 ·  中国 江西 南昌 电信
初级用户
Credits 78
Posts 30
Joined 2006-06-17 18:01
20-year member
UID 57168
Gender Female
From 湖南湘潭
Status Offline
Brother willsort,

echo exit|%comspec% /k prompt _$T$_::> _GenARnd.bat

I only know that the | command uses the output of the previous command as the input of the next command. So it means using exit as the input of the next command. %comspec% is the environment variable for CMD.

Mainly, prompt _$T$_:: is not understandable at all.

I also tried executing echo exit|%comspec% /k prompt _$T$_::> _GenARnd.bat in CMD, and the generated _GenARnd.bat batch file content is:
(First line is blank)
_21:02:55.29
::exit

What does this code mean? Hope the knowledgeable brothers can help explain, thanks.

[ Last edited by namejm on 2006-11-22 at 10:56 PM ]
Floor 2 Posted 2006-11-22 10:26 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

  If you carefully read the help document of the prompt command, you will understand it.
Floor 3 Posted 2006-11-22 10:39 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Brother yuanzijia08's example above should refer to code running on pure DOS (such as MS-DOS 6.xx or other versions). Because it's not convenient to get the system time under pure DOS, so some characteristics of Prompt are used to achieve the idea... You can refer to the following several threads, which have some relevant (pure DOS) content: )

How to create a TXT file in a DOS batch and write the current date
http://www.cn-dos.net/forum/viewthread.php?tid=24259&fpage=6

How to extract or replace the content in a txt file
http://www.cn-dos.net/forum/viewthread.php?tid=11061&fpage=6
(Note: The introduced tool is on the 5th floor of this thread)
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 4 Posted 2006-11-22 12:26 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Recommend learning NT batch processing, and don't study batch processing under pure DOS

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 5 Posted 2006-11-23 11:32 ·  中国 江西 南昌 电信
初级用户
Credits 78
Posts 30
Joined 2006-06-17 18:01
20-year member
UID 57168
Gender Female
From 湖南湘潭
Status Offline
Thanks to everyone for your replies. I also can't tell which are NT batch scripts and which are DOS ones.
Floor 6 Posted 2006-11-23 11:36 ·  中国 江西 南昌 电信
初级用户
Credits 78
Posts 30
Joined 2006-06-17 18:01
20-year member
UID 57168
Gender Female
From 湖南湘潭
Status Offline
Really, which are NT batch scripts and which are DOS system ones? Is there any way that I can tell at a glance?
Floor 7 Posted 2006-11-23 12:05 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
In NT/Xp, there are full of things like for set, token, delim, etc. In pure DOS, it's all about prompt, etc.

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 8 Posted 2006-11-23 12:12 ·  中国 江西 南昌 电信
初级用户
Credits 78
Posts 30
Joined 2006-06-17 18:01
20-year member
UID 57168
Gender Female
From 湖南湘潭
Status Offline
I just looked at the help for prompt. I didn't know at first that this was a command. $T is to get the time, and $_ is to create a new line.

What does the two colons after prompt _$T$_:: mean? I infer from the following code experiment result that it should be that inputting the exit output from the previous echo exit as the subsequent input, and exactly the exit is input after ::, and then the CMD window is exited, right?

I also tried executing echo exit|%comspec% /k prompt _$T$_::> _GenARnd.bat under CMD, and the generated _GenARnd.bat batch file content is:
(The first line is a blank line)
_21:02:55.29
::exit

I also found that when I execute the command echo exit|prompt _$T$_::> _GenARnd.bat, the created _GenARnd.bat batch file is a blank batch file, unlike the instruction echo exit|%comspec% /k prompt _$T$_::> _GenARnd.bat which will save the output of the instruction to the _GenARnd.bat batch file. Why is this? It should also be saved.

Even if I randomly execute an echo eeee> _GenARnd.bat, eeee will also be retained in the _GenARnd.bat batch file.

[ Last edited by yuanzijia08 on 2006-11-23 at 12:15 PM ]
Floor 9 Posted 2006-11-24 06:07 ·  中国 江西 南昌 电信
初级用户
Credits 78
Posts 30
Joined 2006-06-17 18:01
20-year member
UID 57168
Gender Female
From 湖南湘潭
Status Offline
No one to help? Everyone help solve it
Forum Jump: