Only use MTEE v1.1 for compatibility with Windows 9x/ME
Users of Windows NT4/2000/XP/2003 should use MTEE v2.0

Back  
MTEE Commandline Standard Stream Splitter [v1.1]


About Mtee

Parameters
Examples

About Mtee

Mtee is a Win32 commandline utility that directs any text it receives from stdin, to the console and to any number of files. Useful if you want to watch and record the output from a batch file or program.

Mtee is 19k standalone executable. It does not create any temporary files, nor does it write to the registry. There is no installation procedure, just run it.

Mtee is simple to use and only has several options. To list them, type mtee /?.

Note: If you're running w9x/Me and looking for a way to redirect/capture/tee stderr, I recommend the free Win95Cmd utility. This will allow you to use the same redirection syntax that NT4/2K/XP/2003 offers.

Parameters

MTEE [/C] [/D] [/T] [file [/A]] [... [/A]]

/C Continue even if there is an error opening or writing to a file.
/D Prepends each line with local date in YYYY-MM-DD format.
/T Prepends each line with local time in HH:MM:SS.MSS format.
file File to receive the output. If file exists it is overwritten.
/A Append to existing file (if omitted, existing file is overwritten).
...

Any number of additional files. Use /A after each file to append.

Examples

View Mtee help screen:-

MTEE /?

Send the output of A.BAT to the console and to result.log. If result.log already exists, it will be overwritten:-

A.BAT | MTEE result.log

Send the output of the automated ftp session to the console and to two log files, local.log is overwritten if it already exists. Remote.log is appended to if it exists, otherwise it is created:-

FTP -N -S:SCRIPT SVR | MTEE local.log \\svr\c$\logs\remote.log /A

Make two copies of LOG whilst viewing LOG on the screen. If NEW1 and NEW2 already exist, they are overwritten:-

MTEE < LOG NEW1 NEW2

Redirect stdout from NP.BAT to the NUL device, and stderr from NP.BAT to the console and ERR.TXT. Preceed each line of output from MTEE with date and time:-

NP.BAT 2>&1 1>NUL | MTEE /D /T ERR.TXT

Send the output from BACKUP.CMD to the console and two remote log files. If there is an error opening any of the log files (server offline for instance) MTEE will not abort. If the destination files already exist, they are appended to:-

BACKUP.CMD | MTEE /C \\svr1\log$\bu.log /A \\svr2\logs$\bu.log /A