Board logo

标题: [文件操作] 批处理怎么实现输出结果到控制台同时写入到文件 [打印本页]

作者: 1528354811    时间: 2017-6-19 11:48     标题: 批处理怎么实现输出结果到控制台同时写入到文件

本帖最后由 pcl_test 于 2017-6-19 14:27 编辑

批处理输出控制台同时写入到文件 弄了好几天了 求大神帮帮忙  定当万分感谢
作者: ShowCode    时间: 2017-6-19 12:46

参考
http://bbs.bathome.net/thread-44397-1-1.html
作者: 1528354811    时间: 2017-6-19 14:32

回复 2# ShowCode


    需要使用第三方工具是吗?
作者: ShowCode    时间: 2017-6-19 15:14

回复 3# 1528354811


    是的,是的。
作者: 1528354811    时间: 2017-6-19 15:29

回复 4# ShowCode


    您说的这个可是可以用 但是他每次写入的时候会把以前写在文件中的内容清空是吗?   加我QQ详谈吧 1528354811
作者: ShowCode    时间: 2017-6-19 15:43

回复 5# 1528354811


    tee -a 表示 append 追加写入,不会清空以前的,你试试吧。
作者: 1528354811    时间: 2017-6-19 15:46

回复 6# ShowCode


    这个我试过了  是用tee的话他写入的日志文件会缺少一部分不知怎么的  然后我使用了mtee 但是mtee好像不可以带参数
作者: ShowCode    时间: 2017-6-19 16:45

回复 7# 1528354811


mtee的参数不一样

C:\Test>echo bbs > 1.txt

C:\Test>type 1.txt
bbs

C:\Test>echo bathome | mtee /+ 1.txt
bathome

C:\Test>echo net | mtee /+ 1.txt
net

C:\Test>type 1.txt
bbs
bathome
net




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2