Article ID: 110930 - Last Review: February 20, 2007 - Revision: 3.3 Redirecting Error Messages from Command Prompt: STDERR/STDOUTThis article was previously published under Q110930 On This PageSUMMARY
When redirecting output from an application using the ">" symbol, error
messages still print to the screen. This is because error messages are
often sent to the Standard Error stream instead of the Standard Out stream.
Output from a console (Command Prompt) application or command is often sent to two separate streams. The regular output is sent to Standard Out (STDOUT) and the error messages are sent to Standard Error (STDERR). When you redirect console output using the ">" symbol, you are only redirecting STDOUT. In order to redirect STDERR you have to specify "2>" for the redirection symbol. This selects the second output stream which is STDERR. EXAMPLEThe command "dir file.xxx" (where file.xxx does not exist) will display the following output:
Volume in drive F is Candy Cane
Volume Serial Number is 34EC-0876
File Not Found
File Not Found
APPLIES TO
| Article Translations
|

Back to the top
