|
yuanzijia08
初级用户
 
积分 78
发帖 30
注册 2006-6-17 来自 湖南湘潭
状态 离线
|
『楼 主』:
请教willsort以及 各位 大哥关于prompt _$T$_
使用 LLM 解释/回答一下
willsort大哥
echo exit|%comspec% /k prompt _$T$_::> _GenARnd.bat
这个句子看不懂 我只知道|命令是将前一命令的输出当作后一命令的输入来用
那就是将exit当后一命令的输入来用咯 %comspec% 是CMD 的环境变量
主要是prompt _$T$_::看不懂 一点头绪都没有
我也试了将echo exit|%comspec% /k prompt _$T$_::> _GenARnd.bat在CMD下面执行了一遍 生成的_GenARnd.bat批处理文件 内容是:
(第一行为空行)
_21:02:55.29
::exit
这段代码是什么意思啊? 希望各位知道的大哥能帮忙解释一下 谢谢
Last edited by namejm on 2006-11-22 at 10:56 PM ]
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 ]
|
|
2006-11-22 10:16 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
如果你把prompt命令的帮助文档仔细的看一遍就明白了。
If you carefully read the help document of the prompt command, you will understand it.
|
|
2006-11-22 10:26 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
yuanzijia08兄上面的例子应该是指运行在纯dos上的代码(如:MS-DOS 6.xx 或其它版本),
因为在纯dos下取系统时间不太方便,所以利用了Prompt的某些特性来完成想法……
可以参考下面的几个贴子,里面有一些相关的(纯dos)内容:)
请问如何在DOS批处理中创建一个TXT文件,并写入当前的日期
http://www.cn-dos.net/forum/viewthread.php?tid=24259&fpage=6
如何提取或替换txt文件里的内容
http://www.cn-dos.net/forum/viewthread.php?tid=11061&fpage=6
(注:介绍的工具在这个贴子的第5楼)
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,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-22 10:39 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
推荐学习NT批处理,不要研究纯DOS下的批处理
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'>" |
|
2006-11-22 12:26 |
|
|
yuanzijia08
初级用户
 
积分 78
发帖 30
注册 2006-6-17 来自 湖南湘潭
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
谢谢各位的回帖 我也分不清楚哪些是NT的批处理 哪些是DOS的
Thanks to everyone for your replies. I also can't tell which are NT batch scripts and which are DOS ones.
|
|
2006-11-23 11:32 |
|
|
yuanzijia08
初级用户
 
积分 78
发帖 30
注册 2006-6-17 来自 湖南湘潭
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
真的 哪些是NT的批处理 那些是DOS系统的哦 有什么办法可以让我一眼就能看出来吗?
Really, which are NT batch scripts and which are DOS system ones? Is there any way that I can tell at a glance?
|
|
2006-11-23 11:36 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
NT/Xp里的充满了 for set 什么 token delim 之类的。纯DOS下的全部是 prompt 等。
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'>" |
|
2006-11-23 12:05 |
|
|
yuanzijia08
初级用户
 
积分 78
发帖 30
注册 2006-6-17 来自 湖南湘潭
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
我刚才看了 prompt的帮助 我开始还不知道这是个命令 $T这个是取时间 $_这个是换行
prompt _$T$_:: 这后面这两个冒号 是什么意思呢 我根据下面这段代码实验结果推测应该是输入 前面echo exit 输出的exit 当作后面的输入 正好exit就输入到 ::后面 然后就退出 CMD窗口是吗
我也试了将echo exit|%comspec% /k prompt _$T$_::> _GenARnd.bat在CMD下面执行了一遍 生成的_GenARnd.bat批处理文件 内容是:
(第一行为空行)
_21:02:55.29
::exit
我还发现我执行echo exit|prompt _$T$_::> _GenARnd.bat 这条命令的时候在创建的_GenARnd.bat 批处理文件中是一个空白批处理 不象echo exit|%comspec% /k prompt _$T$_::> _GenARnd.bat 这个指令一样会将指令的输出保存到_GenARnd.bat 这个批处理中 这是为什么?应该也会保存啊
即使我随便执行一个echo eeee> _GenARnd.bat 也会将eeee保留在 _GenARnd.bat 批处理中啊
Last edited by yuanzijia08 on 2006-11-23 at 12:15 PM ]
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 ]
|
|
2006-11-23 12:12 |
|
|
yuanzijia08
初级用户
 
积分 78
发帖 30
注册 2006-6-17 来自 湖南湘潭
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
没有人帮忙?大家帮忙解决下
No one to help? Everyone help solve it
|
|
2006-11-24 06:07 |
|