Tom's Hardware Forums » Windows XP » Windows XP General Discussion » redirect sysout and syserr to same file?
 

redirect sysout and syserr to same file?

Add a reply



 Word :   Username :  
 
Bottom
Author
 Thread : redirect sysout and syserr to same file?
 
More Information

Archived from groups: microsoft.public.windowsxp.newusers (More info?)

 

I know

type foo >a.s puts foo into a.s
type foo 2>a.s puts errors into a.s

but what if I want both into the same file?

type foo >a.s 2>a.s doesn't work, neither does
type foo 1>a.s 2>a.s

i can send them to separate files and concatenate - but what a hack

thanks
/j

Related Pr oduct
Register or log in to remove.

More Information

Archived from groups: microsoft.public.windowsxp.newusers (More info?)

 

Jeff W wrote:
> I know
>
> type foo >a.s puts foo into a.s
> type foo 2>a.s puts errors into a.s
>
You might try f >a.s 2>&1. It works under bash. Maybe it'll work on MS.

More Information

Archived from groups: microsoft.public.windowsxp.newusers (More info?)

 

Jeff W wrote:
> I know
>
> type foo >a.s puts foo into a.s
> type foo 2>a.s puts errors into a.s
>
> but what if I want both into the same file?
>
> type foo >a.s 2>a.s doesn't work, neither does
> type foo 1>a.s 2>a.s
>
> i can send them to separate files and concatenate - but what a hack
>
> thanks
> /j

type foo>a.s 2>&1

The >& operator writes the output from one handle to the input of
another handle. So in the above the output of stderr is redirected to
stdout, which is then redirected to a.s.
--
Tom Porterfield
MS-MVP Windows
http://support.telop.org

Please post all follow-ups to the newsgroup only.

More Information

Archived from groups: microsoft.public.windowsxp.newusers (More info?)

 

thanks guys


Tom Porterfield wrote:

>Jeff W wrote:
>> I know
>>
>> type foo >a.s puts foo into a.s
>> type foo 2>a.s puts errors into a.s
>>
>> but what if I want both into the same file?
>>
>> type foo >a.s 2>a.s doesn't work, neither does
>> type foo 1>a.s 2>a.s
>>
>> i can send them to separate files and concatenate - but what a hack
>>
>> thanks
>> /j
>
>type foo>a.s 2>&1
>
>The >& operator writes the output from one handle to the input of
>another handle. So in the above the output of stderr is redirected to
>stdout, which is then redirected to a.s.
>
>


Go to:
Add a reply
  Tom's Hardware Forums » Windows XP » Windows XP General Discussion » redirect sysout and syserr to same file?
 

Google Ads