View Single Post
Old 09-14-2007   #5 (permalink)
Romu


 
 

Re: Catching stdout AND stderr

It works thanks.

But what about args ?? My arguments are stored in PoSH variables. That's
why, from now, my script is writtent calling utilities with
"Invoke-Expression" as I have to format my input before.

I've just tried to call with something like: scp $mypc and this doesn't work.

Any solution using Invoke-Expression?

"Oisin Grehan" wrote:
Quote:

> On Sep 13, 9:34 am, Romu <R...@xxxxxx> wrote:
Quote:

> > Hi all,
> > I'm calling some cygwin utility from PSH: rsyncn scp, ssh...
> >
> > I would like to know how I can catch stdout AND stderr at the same time ?
> >
> > Thanks for your help.
>
> Hi Romu,
>
> Try:
>
> ps> scp args > log.txt 2>&1
>
> This is the same syntax as unix/dos and works fine with legacy apps.
> It's not so good with native powershell cmdlets though since
> powershell has a few more "streams" apart from stdout/stderr. This is
> a popular request (nay, pleading?) from v1 powershell users.
>
> - Oisin
>
>
My System SpecsSystem Spec