![]() |
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-09-15 13:38 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS批处理 & 脚本技术(批处理室) » Asking Willsort and all brothers about prompt _$T$_ |
| Printable Version 1,741 / 8 |
| Floor1 yuanzijia08 | Posted 2006-11-22 10:16 |
| 初级用户 Posts 30 Credits 78 From 湖南湘潭 | |
|
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 ] |
|
| Floor2 lxmxn | Posted 2006-11-22 10:26 |
| 版主 Posts 4,938 Credits 11,386 | |
|
If you carefully read the help document of the prompt command, you will understand it. |
|
| Floor3 redtek | Posted 2006-11-22 10:39 |
| 金牌会员 Posts 1,147 Credits 2,902 | |
|
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) |
|
| Floor4 electronixtar | Posted 2006-11-22 12:26 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Recommend learning NT batch processing, and don't study batch processing under pure DOS
|
|
| Floor5 yuanzijia08 | Posted 2006-11-23 11:32 |
| 初级用户 Posts 30 Credits 78 From 湖南湘潭 | |
|
Thanks to everyone for your replies. I also can't tell which are NT batch scripts and which are DOS ones.
|
|
| Floor6 yuanzijia08 | Posted 2006-11-23 11:36 |
| 初级用户 Posts 30 Credits 78 From 湖南湘潭 | |
|
Really, which are NT batch scripts and which are DOS system ones? Is there any way that I can tell at a glance?
|
|
| Floor7 electronixtar | Posted 2006-11-23 12:05 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
In NT/Xp, there are full of things like for set, token, delim, etc. In pure DOS, it's all about prompt, etc.
|
|
| Floor8 yuanzijia08 | Posted 2006-11-23 12:12 |
| 初级用户 Posts 30 Credits 78 From 湖南湘潭 | |
|
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 ] |
|
| Floor9 yuanzijia08 | Posted 2006-11-24 06:07 |
| 初级用户 Posts 30 Credits 78 From 湖南湘潭 | |
|
No one to help? Everyone help solve it
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |