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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
PJonDevelopment
Posts: 2
Joined: 30 Dec 2009 21:19

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

#1 Post by PJonDevelopment » 01 Feb 2010 08:46

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,

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

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

#2 Post by aGerman » 01 Feb 2010 09:27

PJonDevelopment

The solution is simple.

Code: Select all

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


Regards
aGerman


Post Reply