[ACCEPTED]-How to capture stderr on Windows/DOS?-stderr

Accepted answer
Score: 45

For example:

PSKILL NOTEPAD >output.txt 2>&1

This will direct stdout and 2 stderr to a file name output.txt.

See Underused features of Windows batch files for 1 more details.

Score: 20

That should work in Win32, too.

If you have 5 already redirected stdout, and want stderr 4 redirected to the same file, you must use 3 the 2>& special form, rather than just 2 specifying the same file twice. Otherwise 1 you'll get a "file busy" error.

More Related questions