Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to capture all the messages from cmd.exe.

I tried abc.exe &> res.dat, but it doesn't seem to work with stderr or others. What should I do?

share|improve this question

Reconstruct your command like so:

abc.exe >res.dat 2>&1

This will send STDERR to the same location.

share|improve this answer
OP wants to capture all output from cmd.exe not abc.exe -- I think the difference matters. – martineau Feb 24 '11 at 20:54
What other messages will cmd output when he is running abc.exe? ... – John T Feb 25 '11 at 1:46
Oh, I don't know, maybe 'abc.exe' is not recognized as an internal or external command, operable program or batch file. – martineau Jul 20 '11 at 14:48
@martineau, that string is part of standard error and will be captured by my command, but thanks for playing. – John T Jul 20 '11 at 18:24
abc.exe 1>2> res.dat

also works.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.