Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Catching stdout AND stderr

Reply
 
Old 09-13-2007   #1 (permalink)
Romu


 
 

Catching stdout AND stderr

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.

My System SpecsSystem Spec
Old 09-13-2007   #2 (permalink)
Marco Shaw


 
 

Re: Catching stdout AND stderr

Romu 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.
You're looking just to log this info? Since you're not using cmdlets,
look into start-transcript/stop-transcript.

Marco

--
----------------
PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 09-13-2007   #3 (permalink)
Oisin Grehan


 
 

Re: Catching stdout AND stderr

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
Old 09-13-2007   #4 (permalink)
Keith Hill


 
 

Re: Catching stdout AND stderr

"Oisin Grehan" <oising@xxxxxx> wrote in message
news:1189728583.046781.265180@xxxxxx
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.
The issue has been submitted here is anyone wants to vote on it:

https://connect.microsoft.com/feedba...7055&SiteID=99

--
Keith

My System SpecsSystem Spec
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
Reply

Thread Tools


Similar Threads
Thread Forum
Deadlock when logging to stdout and stderr PowerShell
StdOut and StdErr reading... VB Script
redirect powershell stdout to objShell.Exec.Stdout.ReadAll()( PowerShell
Output to STDERR PowerShell
Help with stderr from native console application PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46