I\'m trying to redirect all output (stdout + stderr) of a DOS command to a single file:
C:\\>dir 1> a.txt 2> a.txt
The process cannot access the fil
Anders Lindahl's answer is correct, but it should be noted that if you are redirecting stdout to a file and want to redirect stderr as well then you MUST ensure that 2>&1
is specified AFTER the 1>
redirect, otherwise it will not work.
REM *** WARNING: THIS WILL NOT REDIRECT STDERR TO STDOUT ****
dir 2>&1 > a.txt