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
You want:
dir > a.txt 2>&1
The syntax 2>&1 will redirect 2 (stderr) to 1 (stdout). You can also hide messages by redirecting to NUL, more explanation and examples on MSDN.
2>&1
2
1
NUL