Click to See Complete Forum and Search --> : Batch file that redirects stderr/stdout to file + displays stderr/stdout to terminal


MaryN
August 24th, 2007, 11:57 AM
I have a java program that is started up via a batch file, and we would like to send both stdout/stderr to a file along with displaying sdtout/stderr to the screen. I am working in Windows XP environment, and I know that in Unix-like environment you can use the "tee" command to accomplish this task. However, the "tee" command is not available on Windows XP, and my system administrator does not want me to download any applications.

Here is how I would handle the situation in a Unix-like environment:
java programx 2>&1 |tee -a -i log.txt

Is there some equivalent way to do above line in Windows XP.

PeejAvery
August 24th, 2007, 01:21 PM
I don't know about the first part of your programx part, but you can just use >> to append to a file. The following will append directory information to the end of file.txt.

dir >> file.txt