Board logo

标题: [其他] 有关mtee v2.21版本的参数/E的问题 [打印本页]

作者: shootman2    时间: 2017-1-10 23:35     标题: 有关mtee v2.21版本的参数/E的问题

最近发现mtee升级到了最新的2.21版本,下载下来后发现,里面新增了一个参数 /E,貌似是在可以将errorlevel在使用管道
后仍然可见,但是我一直没有试验成功,求大神帮忙分析一下

MTEE v2.21 Win32 Commandline Standard Stream Splitter for Windows XP .. 10.
Copyright (c) 2001-2016 Ritchie Lawrence, http://www.commandline.co.uk.

  MTEE [/A | /U] [/C] [/D] [/T] [/E] [[/+] file] [...]

  /A    Convert output to ANSI. Default output is same as input.
  /C    Continue if errors occur opening/writing to file (advanced users only).
  /D    Prefix each line of output with local date in YYYY-MM-DD format.
  /T    Prefix each line of output with local time in HH:MM:SS.MSS format.
  /U    Convert output to UNICODE. Default output is same as input.
  /E    Exit with exit code of piped process.
  /+    Append to existing file. If omitted, existing file is overwritten.
  file  File to receive the output. File is overwritten if /+ not specified.
  ...   Any number of additional files. Use /+ before each file to append.

  Example usage:-

  1) script.cmd | mtee result.txt
  2) ftp -n -s:ftp.scr | mtee local.log /+ \\server\logs$\remote.log
  3) update.cmd 2>&1 | mtee/d/t/+ log.txt

  1) Sends the output of script.cmd to the console and to result.log. If
     result.txt already exists, it will be overwritten.
  2) Sends output of automated ftp session to the console and two log files,
     local.log is overwritten if it already exists, remote.log is appended to.
  3) Redirects stdout and stderr from update.cmd to console and appends to
     log.txt. Each line is prefixed with local date and time.
作者: GNU    时间: 2017-1-11 20:20

你的测试用例和测试结果在哪里?
作者: shootman2    时间: 2017-1-11 20:43

回复 2# GNU


aaa.bat
@echo off
echo testing mtee
exit /b 1

bbb.bat
call aaa.bat | mtee /E
echo %errorlevel%

执行bbb.bat后,输出结果仍然是0
作者: Batcher    时间: 2017-1-11 21:47

回复 3# shootman2


bbb.bat改成这样:
call aaa.bat | mtee /E 1.log
echo %errorlevel%
作者: shootman2    时间: 2017-1-12 23:09

回复 4# Batcher


    执行结果还是输出 0
作者: Batcher    时间: 2017-1-13 10:56

回复 5# shootman2


    我这边测试是 1
作者: shootman2    时间: 2017-1-13 21:42

回复 6# Batcher


    你的操作系统版本是多少呢?
作者: Batcher    时间: 2017-1-14 01:13

回复 7# shootman2


    Win7 SP1
作者: shootman2    时间: 2017-1-17 00:11

回复 8# Batcher


    你的系统版本应该是32位的吧?我在win xp 32位下测试是ok的,但是在win7 sp1 64位上测试返回是0
作者: Batcher    时间: 2017-1-18 12:01

回复 9# shootman2


    我也是64位




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