问题描述
是否有可能将输出写入相同的多个文件中批?
我为希望这样做的原因是因为我有产生一个非常详细的日志大批量脚本。这很好,因为它是,但我想日志的输出也修整一回的版本与它少了很多细节。该批次也不能运行多次。
Is it possible to write the same output to more than one file in Batch?My reason for wanting to do this is because I have a large batch script that produces a very detailed log. This is fine as it is, but i want to also output a trimmed back version of the log with a lot less detail in it. The Batch cannot be run multiple times either.
例如说我有一个简单的批处理:
Say for instance I have a simple batch:
Echo This is a Batch Script >> Path\File1 & Path\File2
osql -S%SERVERNAME% -E -d%DATABASENAME% -Q%SQL% >> Path\File1
鸭preciate任何帮助。
Appreciate any help.
推荐答案
也许你可以使用 T恤
命令。可下载从 rel=\"nofollow\">。你可以把它像一个T,一个管道工可能使在管道送水两种方式。
Maybe you can use the tee
command from Unix tools. Downloadable for free from here. Think of it like a "T" that a plumber might put in a pipe to send water two ways.
osql -S%SERVERNAME% -E -d%DATABASENAME% -Q%SQL% | tee file1 file2 file3
看一看一些例子,因为我并不完全相信你完全处理的要求是什么,看到的。
如果你想要做一个流进行一些处理,你可以这样做:
If you want to do some processing on one stream you can do this:
osql -S%SERVERNAME% -E -d%DATABASENAME% -Q%SQL% | tee unfiltered.txt | FINDSTR /v "UglyStuff" > filtered.txt
这篇关于写输出到多个相同的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!