Page 1 of 1

Redirecting both stdout and stderr to a single file... how?!

Posted: 01 Feb 2010 08:46
by PJonDevelopment
Greetings

I know it seems a silly question, but I'm kinda stuck.

I'm creating a bat that calls another one.

OK so far so good.

However I want to redirect both the stdout and stderr to the same file.

I've tried

Code: Select all

call myOtherFile.bat 1>logFile.log 2>logFile.log

and

Code: Select all

call myOtherFile.bat 1>logFile.log 2>>logFile.log

and also

Code: Select all

call myOtherFile.bat 1>>logFile.log 2>>logFile.log

with no avail.

Does anyone know how to do this?

Regards,

Re: Redirecting both stdout and stderr to a single file... how?!

Posted: 01 Feb 2010 09:27
by aGerman
PJonDevelopment

The solution is simple.

Code: Select all

call myOtherFile.bat>logFile.log 2>&1


Regards
aGerman

Re: Redirecting both stdout and stderr to a single file... how?!

Posted: 01 Feb 2010 21:08
by PJonDevelopment
Thanks!