Command-line: How to redirect Windows stdout and stderr to a single file

When investigating complex issues with Maven or command-line tools, it is often helpful to capture the output to a file for further analysis.

This tip shows how to capture both ‘stdout’ and ‘stderr’ to capture a complete authoritative output.

mvn test >testlog.txt 2>&1

Original credit to Anders Lindahl on StackOverflow.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>