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


 
 

stdout redirection

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