[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程批处理在线视频分享
返回列表 发帖

[其他] 有关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.

你的测试用例和测试结果在哪里?

TOP

回复 2# GNU


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

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

执行bbb.bat后,输出结果仍然是0

TOP

回复 3# shootman2


bbb.bat改成这样:
call aaa.bat | mtee /E 1.log
echo %errorlevel%
【论坛捐助】http://bbs.bathome.net/thread-10403-1-1.html
【批处理在线视频分享】http://bbs.bathome.net/thread-31727-1-1.html
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html

TOP

回复 4# Batcher


    执行结果还是输出 0

TOP

回复 5# shootman2


    我这边测试是 1
【论坛捐助】http://bbs.bathome.net/thread-10403-1-1.html
【批处理在线视频分享】http://bbs.bathome.net/thread-31727-1-1.html
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html

TOP

回复 6# Batcher


    你的操作系统版本是多少呢?

TOP

回复 7# shootman2


    Win7 SP1
【论坛捐助】http://bbs.bathome.net/thread-10403-1-1.html
【批处理在线视频分享】http://bbs.bathome.net/thread-31727-1-1.html
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html

TOP

回复 8# Batcher


    你的系统版本应该是32位的吧?我在win xp 32位下测试是ok的,但是在win7 sp1 64位上测试返回是0

TOP

回复 9# shootman2


    我也是64位
【论坛捐助】http://bbs.bathome.net/thread-10403-1-1.html
【批处理在线视频分享】http://bbs.bathome.net/thread-31727-1-1.html
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html

TOP

返回列表