Process.Start with findstr

Hello,

I have used the following line to get values using findstr and throwing those results into a file.

Process.Start("findstr", @"/D:c:\windows\system32 drivername *.ini > c:\windows\system32\file.txt");

It seems to work except it does not create a file. Any ideas on how to make it pipe the results to a file

Thanks for any help.

Mike


Answer this question

Process.Start with findstr

  • djshades2004

    Figured it out. Here is the code for future reference.

    Process myproc = new Process();

    myproc.StartInfo.FileName = "findstr";

    myproc.StartInfo.Arguments = "/D:c:\\windows\\system32 drivername *.ini";

    myproc.StartInfo.RedirectStandardOutput = true;

    myproc.StartInfo.UseShellExecute = false;

    myproc.Start();

    string output = myproc.StandardOutput.ReadToEnd();

    myproc.WaitForExit();


    Later,

    Mike

  • Process.Start with findstr