title: Execute multiple command (using BCP) with same ProcessStartInfo instance in C#
body: <p>I know that my title seems with others from StackOverflow but my intention is other.</p>
  
  <p>I created a C# function which creates BCP files for every table from my database using BCP command. The below code is a sample, part of function.</p>
  
  <pre><code>List&lt;string&gt; tables = GetTables(); // a function which takes all tables from my database
  
  string command = @"bcp ADatabase.dbo.{0} out {0}.bcp -n -Usa -Ppassword";
  
  ProcessStartInfo processInfo = null;
       try {
          foreach ( string table in tables ) {
             command = string.Format( command, table );
             processInfo = new ProcessStartInfo( "cmd", "/c " + command );
             processInfo.RedirectStandardOutput = true;
             processInfo.CreateNoWindow = false;
             Process process = new Process();
             process.StartInfo = processInfo;
             process.Start();
             string result = process.StandardOutput.ReadToEnd();
             Console.WriteLine( result );
          }
       } catch ( Exception e ) {
          Console.WriteLine( e.Message );
       }
  </code></pre>
  
  <p>I want to avoid executing multiple windows and I want to execute each command line in same window.</p>
  
  <p>My code is good or is an alternative ?</p>
  
  <p>Thanks</p>