Parsing Command Line Output?


  • Ok so I am new to programming (still in school), so hopefully this isn't a really dumb question...

    I am working with an application at the command line level...first I figured out all the commands I need to enter for the desired I am trying to create an application in C# to "automate" these far I have figured out how to actually process my commands using the Process class (ProcessStartInfo etc). All of this is working perfectly, but now I need to do some monitoring of these actions...the commands are being run in a "verbose" my question is do I parse the verbose output from my command arguments being passed in? For example, when I run a command, there is a return value of 1 "RETURN VALUE: 1". I need to parse that output to verify that the return value is 1. There is other output as well that I need to verify, that is just an example.

    I have done some searching online, but all I can find information on is parsing command line arguments...which is not what I'm trying to do.

    Any help is appreciated!

    Monday, November 16, 2009 4:51 PM


All replies

  • So upon further research I think I have found one option...

    I can redirect Console.out to a text file and then parse the text file for the information I am looking for?

    Is that the best route to take for this problem? It seems like there should be a way to directly parse the output from the console...but perhaps not.

    Thanks for any input,

    Monday, November 16, 2009 6:28 PM
  • Hello, George,
    Actually, You don't need to parse the output, Could use the static overload Process.Start method
    public static Process Start (
        string fileName,
        string arguments

    This method will return an Process object, and the Process class have a property called Process.ExitCode, this will show the result of your command execution.
    If you have anything unclear, feel free to let me know.

    Wednesday, November 18, 2009 7:20 AM