MTEE Standard Stream Splitter for Windows 2000/XP/2003/Vista/Win7/2008/Win8

About Mtee

What's New

About Mtee

Mtee is a commandline utility that sends any data it receives 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 an 11kb standalone executable. It does not create any temporary files or write to the registry. There is no installation procedure, just run it. To remove all traces of Mtee from your system, just delete it.

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

What's New

Version 2.1 is now open source software released under the MIT License,.

Credit to Jari Kulmala for addressing the following:-

  • mtee is now Windows 8 compatible
  • mtee assumed all files < 4GB
  • echo "t013|mtee /u con" entered a continuous loop
  • "echo x x x x | mtee" caused mtee to guess input was unicode
  • redirection to console and con device as output file was not supported

The following features are new to Mtee v2.0

  • Read and output unicode
  • Convert ANSI to unicode (and vice-versa)
  • Reads text and binary data without performing any character translations
  • Support for unicode filenames of ~32,000 characters
  • Smaller than ever. Mtee is now just 11kb (and no, it's not compressed!)



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

/A Convert output to ANSI. Default output is the same as input
/C Continue if errors occur opening/writing to file (advanced users only)
/D Prepends each line with local date in YYYY-MM-DD format (ISO-8601).
/T Prepends each line with local time in HH:MM:SS.MSS format (ISO-8601).
/U Convert output to Unicode. Default output is the same as input
/+ 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

The parameters can be specified in any order. The only requirement is that the /+ switch, if used, must be followed by a filename.


View Mtee help screen:-


Send the output of script.cmd to the console and to RESULT.LOG. If RESULT.LOG already exists, it will be overwritten:-

script.cmd | 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:ftp.scr | mtee local.log /+ \\server\logs\remote.log

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 and stderr from UPDATE.CMD to the console and appends to LOG.TXT. Each line is prefixed with local date and time:-

update.cmd 2>&1 | mtee/d/t/+ log.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 continue. If the destination files already exist, they are appended to:-

backup.cmd | mtee /c/+ \\svr1\log$\bu.log /+ \\svr2\logs$\bu.log

Make multiple carbon copies of patch.exe:-

type patch.exe|mtee \\pc1\c$\patch.exe \\pc2\c$\patch.exe \\pc3\c$\patch.exe

Make a unicode log of HFNETCHK:-

hfnetchk|mtee/u log

Display stdout on the console, and stderr on the console and also to a log file with each line of stderr prefixed with local date and time:-

batch.cmd 2>&1 1>&3 3>&1 |mtee/t/d log