Friday, December 6, 2013

Redirect STDOUT and STDERR from command prompt and in batch files

Redirect STDOUT to stdout.txt:

dir > stdout.txt

Redirect STDERR to stderr.txt:

dir 2> stderr.txt

Redirect STDOUT to stdout.txt and STDERR to stderr.txt:

dir > stdout.txt 2> stderr.txt

Redirect STDOUT and STDERR to stdout_and_stderr.txt:

dir 1> stdout_and_stderr.txt 2>&1

No comments:

Post a Comment