|
zhaxi
初级用户
 
积分 112
发帖 40
注册 2006-6-23
状态 离线
|
『楼 主』:
[求助]如何实现既在屏幕上显示执行结果又可以把结果保存到
使用 LLM 解释/回答一下
这个标题的意思是说,比如执行了xcopy命令,会在屏幕上显示很多条执行结果:
---------------------------------------
\\192.168.1.1\update\1.txt
\\192.168.1.1\update\2.txt
\\192.168.1.1\update\3.txt
复制了3个文件
---------------------------------------
如果我需要将此命令结果保存到d:\a.txt,故我使用了xcopy ....>d:\a.txt ,但这样做的结果是屏幕上不会显示上面执行的结果了。虽然现在可以再最后加一句
type d:\a.txt 将刚才的结果在屏幕上输出,但却具有滞后效果。而且不是想当初一样每xcopy一个文件就会在屏幕上动态显示执行结果。
我现在想问有没有一种语句可以即不影响在屏幕上显示结果,同时可以将结果保存到一个文件中。
The meaning of this title is that, for example, when the xcopy command is executed, many execution results will be displayed on the screen:
---------------------------------------
\\192.168.1.1\update\1.txt
\\192.168.1.1\update\2.txt
\\192.168.1.1\update\3.txt
3 files copied
---------------------------------------
If I need to save this command result to d:\a.txt, so I used xcopy ....>d:\a.txt, but the result is that the above execution results will not be displayed on the screen. Although now I can add a line at the end type d:\a.txt to output the just result on the screen, but it has a lag effect. And it is not the same as before that every time xcopy a file will dynamically display the execution result on the screen.
Now I want to ask if there is a statement that can not affect the display result on the screen and at the same time save the result to a file.
|
|
2006-6-27 22:28 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
可以通过提供这种功能的工具来做到,如TEE,例如使用以下语法:
XCOPY .... | TEE D:\A.TXT
这样既不影响在屏幕上显示结果,同时可以将结果保存到一个(或多个)文件中。
This can be done through tools that provide this function, such as TEE. For example, use the following syntax:
XCOPY .... | TEE D:\A.TXT
This not only does not affect the display of the result on the screen, but also can save the result to one (or more) files.
|

Wengier - 新DOS时代
欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/
E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)
 |
|
2006-6-28 10:51 |
|
|
zhaxi
初级用户
 
积分 112
发帖 40
注册 2006-6-23
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
功能说明:读取标准输入的数据,并将其内容输出成文件。
语 法:tee [-ai][--help][--version][文件…]
补充说明:tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。我们可利用tee把管道导入的数据存成文件,甚至一次保存数份文件。
参 数:-a 附加到既有文件的后面,而非覆盖它。如果给予tee指令的文件名称已经存在,预设会覆盖该文件的内容。加上此参数后,数据会新增在该文件内容的最后面,而不会删除原先之内容。
-i 忽略中断信号
--help 在线帮助
--version 显示版本信息
范 例:
列出文本文件slayers.story的内容,同时复制3份副本,文件名称分别为ss-copy1、ss-copy2、ss-copy3:
$ cat slayers.story |tee ss-copy1 ss-copy2 ss-copy3
-----------------------------------------------------------------------------------------
可惜我就是下载不到这个 软件啊。DOS之家里也不知道放在哪个分类下。你能告诉我下载地址吗?
Function description: Read data from standard input and output its content to a file.
Syntax: tee
Supplementary instructions: The tee command reads data from the standard input device, outputs its content to the standard output device, and saves it as a file at the same time. We can use tee to save the data imported by the pipeline into a file, and even save several files at one time.
Parameters: -a Append to the end of the existing file instead of overwriting it. If the file name given to the tee command already exists, it will overwrite the content of the file by default. With this parameter, the data will be added to the end of the file content instead of deleting the original content.
-i Ignore interrupt signals
--help Online help
--version Display version information
Examples:
List the content of the text file slayers.story, and copy 3 copies at the same time, with the file names ss-copy1, ss-copy2, ss-copy3 respectively:
$ cat slayers.story |tee ss-copy1 ss-copy2 ss-copy3
-----------------------------------------------------------------------------------------
Unfortunately, I just can't download this software. I don't know which category it is in on DOS Home. Can you tell me the download address?
|
|
2006-6-28 12:47 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
Originally posted by zhaxi at 2006-6-28 12:47 PM:
功能说明:读取标准输入的数据,并将其内容输出成文件。
语 法:tee
补充说明:tee指令会从标准输入设备 ...
那些网站中是没有这个软件的。DOS版的TEE见附件:
Originally posted by zhaxi at 2006-6-28 12:47 PM:
Function description: Read data from standard input and output its content to a file.
Syntax: tee
Supplementary instructions: The tee command will read from the standard input device...
There are no such software in those websites. The DOS version of TEE is in the attachment:
附件
1: TEE.EXE (2006-6-28 13:33, 62.5 KiB, 下载附件所需积分 1 点
,下载次数: 156)
|

Wengier - 新DOS时代
欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/
E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)
 |
|
2006-6-28 13:33 |
|
|
qdcr
初级用户
 
积分 120
发帖 32
注册 2006-6-19
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
同问这个问题:
@echo off
MKDIR "..\backup">>%DATE%.log
pause
如果back文件夹存在,在dos console窗口中会显示
A subdirectory or file ..\backup already exists.
而%date%.log中内容为空。
为什么重定向到log文件没有用?
The same question:
@echo off
MKDIR "..\backup">>%DATE%.log
pause
If the back folder exists, in the dos console window it will display
A subdirectory or file ..\backup already exists.
And the content in %date%.log is empty.
Why is the redirection to the log file not working?
|
|
2006-6-28 13:56 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
MKDIR "..\backup">>%DATE%.log
应改为:
MKDIR "..\backup" 2>>%DATE%.log
或
MD "..\backup" 2>>%DATE%.log
MKDIR "..\backup">>%DATE%.log
Should be changed to:
MKDIR "..\backup" 2>>%DATE%.log
or
MD "..\backup" 2>>%DATE%.log
|

Wengier - 新DOS时代
欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/
E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)
 |
|
2006-6-28 14:01 |
|
|
asbai
高级用户
   
积分 653
发帖 252
注册 2006-4-16
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Originally posted by qdcr at 2006-6-28 13:56:
同问这个问题:
@echo off
MKDIR "..\backup">>%DATE%.log
pause
如果back文件夹存在,在dos console窗口中会显示
A subdirectory or file ..\backup already exis ...
>> 只重定向标准输出,不重定向错误输出,要同时重定向错误输出,使用:
MKDIR "..\backup">>%DATE%.log 2>&1
Originally posted by qdcr at 2006-6-28 13:56:
Ask the same question:
@echo off
MKDIR "..\backup">>%DATE%.log
pause
If the back folder exists, it will display in the dos console window
A subdirectory or file ..\backup already exis ...
>> Only redirect standard output, not error output. To redirect error output at the same time, use:
MKDIR "..\backup">>%DATE%.log 2>&1
|
|
2006-6-28 14:01 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
为什么用这个
xcopy ........ 1>con 1>D:\a.txt
或者
xcopy ....... 1>con 1>D:\a.txt 1<&2
不行呢?
可不可以把句柄1的数据copy到句柄4中,然后1到屏幕,4到文件?
或者,用mode命令?感觉上用第三方工具不是很爽
Last edited by electronixtar on 2006-6-28 at 14:24 ]
Why use this?
xcopy ........ 1>con 1>D:\a.txt
Or
xcopy ....... 1>con 1>D:\a.txt 1<&2
Why not?
Can we copy the data of handle 1 to handle 4, then 1 to the screen, and 4 to the file?
Or, use the mode command? It feels not very cool to use third-party tools
Last edited by electronixtar on 2006-6-28 at 14:24 ]
|

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-6-28 14:06 |
|
|
zhaxi
初级用户
 
积分 112
发帖 40
注册 2006-6-23
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
Originally posted by Wengier at 2006-6-28 13:33:
那些网站中是没有这个软件的。DOS版的TEE见附件:
谢谢Wengier啊。我已经拷贝下来了。马上用用看。
另外谁能不能帮我把 choice.exe 也传上来,呵呵。我现在是在XP下使用。还不会装dos。几个月来就在xp下写批处理。
Originally posted by Wengier at 2006-6-28 13:33:
There is no such software in those websites. The DOS version of TEE is attached:
Thanks, Wengier. I've copied it down. I'll use it right away.
Also, can anyone help me upload choice.exe? Hehe. I'm using it under XP now. I don't know how to install DOS yet. I've been writing batch scripts under XP for several months.
|
|
2006-6-28 19:36 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
Originally posted by electronixtar at 2006-6-28 02:06 PM:
为什么用这个
xcopy ........ 1>con 1>D:\a.txt
或者
xcopy ....... 1>con 1>D:\a.txt 1<&2
不行呢?
可不可以把句柄1的数据copy到句柄4中,然后1到屏幕,4到文件?
或者,用mode命令?感觉上用第三方工具不是很爽
这些当然是不行了,如果你真想不用第三方工具来实现的话,还不如这样:
xcopy ....... >a.txt | type a.txt
Originally posted by electronixtar at 2006-6-28 02:06 PM:
Why use this
xcopy ........ 1>con 1>D:\a.txt
Or
xcopy ....... 1>con 1>D:\a.txt 1<&2
It doesn't work?
Can you copy the data of handle 1 to handle 4, then 1 to the screen, and 4 to the file?
Or, use the mode command? It feels not very cool to use third-party tools
These of course don't work. If you really want to achieve it without using third-party tools, it's better to do it like this:
xcopy ....... >a.txt | type a.txt
|

Wengier - 新DOS时代
欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/
E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)
 |
|
2006-6-29 01:21 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by zhaxi at 2006-6-28 07:36 PM:
谢谢Wengier啊。我已经拷贝下来了。马上用用看。
另外谁能不能帮我把 choice.exe 也传上来,呵呵。我现在是在XP下使用。还不会装dos。几个月来� ...
choice命令基本上只在纯DOS下比较有用,在XP下可以用set /p来代替。
Originally posted by zhaxi at 2006-6-20 07:36 PM:
Thank you Wengier. I have copied it down. Use it immediately.
Also who can help me to put choice.exe also pass on, he he. I am now under XP to use. Also will not install dos. For a few months...
The choice command is basically only use in the pure DOS to compare useful, under XP use set /p to replace.
|

Wengier - 新DOS时代
欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/
E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)
 |
|
2006-6-29 01:24 |
|
|
zhaxi
初级用户
 
积分 112
发帖 40
注册 2006-6-23
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
为什么我在xp的cmd中使用tee以后弹出一个新的窗口,显示了一行乱码就结束了。我猜这行乱码肯定就是“已复制 1个文件”。 我要安装什么东西才能把乱码去掉呢。
COPY d:\dos\end.txt d:\ | TEE D:\A.TXT
Why does a new window pop up when I use tee in the cmd of xp, showing a line of garbled code and then closing? I guess this line of garbled code must be "1 file(s) copied". What do I need to install to remove the garbled code?
COPY d:\dos\end.txt d:\ | TEE D:\A.TXT
|
|
2006-6-29 18:54 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Originally posted by zhaxi at 2006-6-29 06:54 PM:
为什么我在xp的cmd中使用tee以后弹出一个新的窗口,显示了一行乱码就结束了。我猜这行乱码肯定就是“已复制 1个文件”。 我要安装什么东西才能把� ...
我自己试了一下上面这个命令,但并没有发现什么弹出显示了一行乱码的新窗口呀?
I myself tried the above command, but didn't find any new window popping up showing a line of garbled code.
|

Wengier - 新DOS时代
欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/
E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)
 |
|
2006-6-30 01:46 |
|
|
zhaxi
初级用户
 
积分 112
发帖 40
注册 2006-6-23
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
哎。我在xp的cmd下运行Tee后好象显示不支持中文名。遇到有中文名的路径显示为???。
这该怎么办啊。
Hey. I ran Tee under the cmd in XP and it seems that Chinese names are not supported. When encountering paths with Chinese names, it shows as ???. What should I do about this?
|
|
2006-7-2 16:24 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
用"chcp 936"命令可将当前显示代码页切换为简体中文。
The command "chcp 936" can switch the current display code page to Simplified Chinese.
|

Wengier - 新DOS时代
欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/
E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)
 |
|
2006-7-3 09:46 |
|