Any Windows implementation of the unix tee command would work perfectly. There are free options out there. I like to use the GNU utilities for Windows, which includes tee.exe.
Usage is simple:
abc.cmd | tee out1.txt >out2.txt
Or, you could write your own implementation of tee using Windows Scripting Host (WSH) - no exe to download! triggeradeadcat attempted to do so, but that implementation is flawed because it uses line based input/output instead of character based. It will not work well if the command has interactive prompts and responses on the same line.
Below is a handy JScript implementation that I have used in many projects. I use hybrid JScript/batch techniques so that the utility can be called directly without having to specify CSCRIPT.
@if (@X)==(@Y) @end /* Harmless hybrid line that begins a JScript comment
::--- Batch section within JScript comment that calls the internal JScript ----
@echo off
cscript //E:JScript //nologo "%~f0" %*
exit /b
----- End of JScript comment, beginning of normal JScript ------------------*/
var fso = new ActiveXObject("Scripting.FileSystemObject");
var mode=2;
if (WScript.Arguments.Count()==2) {mode=8;}
var out = fso.OpenTextFile(WScript.Arguments(0),mode,true);
var chr;
while( !WScript.StdIn.AtEndOfStream ) {
chr=WScript.StdIn.Read(1);
WScript.StdOut.Write(chr);
out.Write(chr);
}
Again, the usage is simple:
abc.cmd | tee out1.txt >out2.txt