View Single Post
Old 10-29-2006   #1 (permalink)
Olav Kindt
Guest


 
 

Redirection of standard out and standard error

All,

I know this has been debated before, but I have searched the old
postings and not found it, so I try to start a new thread on this issue.

I have a legacy application for testing that will write some of its
output to stdout, and some to stderr. I would like to capture the output
from this application so that I can parse the output for the result.

The DOS command for doing this is :

mytest1.exe > test_result.txt 2>&1
mytest2.exe >> test_result.txt 2>&1

Can this be done directly in Powershell??

I have also tried to do

function all_tests {
cmd /c "mytest1.exe > test_result.txt 2>&1"
...

}

When I dot source this file, and call the all_tests function, it hangs,
and when looking at the output in the test_result.txt file i see this:

PS> more test_result.txt
One or more CON code pages invalid for given keyboard code
File not found.
PS>

Can anyone explain to me what this means. Running the command from the
Powershell command line seems to work OK, I only get these messages when
running from a script file.


Hope someone out there can help me

Thanks

Olav
My System SpecsSystem Spec