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:
File Not Found
dir file.xxx 2> nul
dir file.xxx > output.msg 2> output.err
dir file.xxx 1> output.msg 2>&1
文書番号:110930 - 最終更新日: 2008/01/07 - リビジョン: 1