How to Batch Redirection

To merge Standard Output and Standard Error and redirect them together to a single file:

Script.cmd > Script.log 2>&1

To redirect success and error messages to separate log files:

Script.cmd > Script.log 2> ScriptErrors.log

Use >CON to send text to the screen, no matter what, even if the batch file’s output is redirected.
This could be useful when prompting for input even if the batch file’s output is being redirected to a file.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s