I am writing a console app and I want to be able to pipe the results to another file like so.
C:>Myapp.exe > test.txt
Everything works great. But I also want to display some text in the command window like a progress area or something like that.
A good example is the sysinternals app psInfo.
If you run it with psinfo.exe > test.txt you get some text in the cmd window and you also get some information redirected to the test.txt file.
If you do psinfo.exe | find /i “sys” you get results in cmd that don’t match the find and also the find results.
Thanks
Your application can write to standard out as well as to standard error.
For your scenario you should probably write things you want to end up in the file to standard out, and things you want to still show on the screen to standard error.
You use Console.Error to write to standard error
http://msdn.microsoft.com/en-us/library/system.console.error.aspx