View Single Post
Old 12-02-2007   #3 (permalink)
tomaszinc


 
 

Re: stdout redirection

Thanks a lot for your quick answer.

The page is great, but if I don't get it wrong then what he says is: "you
can't capture console output".

I now tried different combinations of |out-string -stream | out-file
-encoding {oem, default} and so on. I actually managed to capture some
command line output correctly, but python script output still is totally
messed up. So what works for one is no solution for another.

I'm sorry, but this is just garbage. I mean, a shell where you can't even
redirect console output to a file is totally worthless, no matter how fancy
the output is presented on screen or what other cool features it offers.

I guess I just stick with cygwin shell scripting, at least MS is not messing
up my data here. It's a pity though, powershell promises so much and then
even the most simple and basic tasks are impossible to do.

But thanks again.

"Kuma" wrote:
Quote:

> On Dec 3, 7:35 am, tomaszinc <tomasz...@xxxxxx>
> wrote:
Quote:

> > Hello everyone,
> > I'm pretty new to powershell scripting so this might seem like a stupid
> > question, excuse me for that. I already searched the forum and documentation
> > but couldn't find a solution so I take my chances here.
> >
> > Basically all I want to do is to write the output of some command line
> > utilities and python scripts into a text file. With cmd I used the '>'
> > operator for that. However, the resulting file is messed up with spaces
> > between each character. I searched the documentation and found info about the
> > commands 'out-file' and 'set-content'. There are a number of different
> > encodings which can be set. I tried every combination of {out-file,
> > set-content} -encoding *, however, the outfile never matches the output
> > generated on the console. Instead either spaces or new-lines are inserted.
> > Since I use this output for further processing it is vital that the file
> > exactly matches the output on stdout.
> > Can anybody tell me how I can redirect the output on stdout to a file
> > without powershell messing with the content?
> >
> > best regards and thanks a lot
>
> Take a look here:
>
> http://keithhill.spaces.live.com/blo...3A97!811.entry
>
> Excellent page for this topic.
>
My System SpecsSystem Spec