How to execute a command via command-line and wait for it to be done
<p>I'm trying to execute a command via command-line and afterwards execute another command (not in cmd) which dependes on the outcome of the former command.
The problem is that the first command takes about 2 minutes to end, and the 2nd command won't "wait" for the first one to end.
How can I hold the 2nd command to wait until the first ends?</p>

<p>Thanks in advance!</p>

<pre><code>public void runCmd(){
  String command = @"/k java -jar myJava.jar";
  ProcessStartInfo cmdsi = new ProcessStartInfo("cmd.exe");
  cmdsi.Arguments = command;
  Process cmd = Process.Start(cmdsi);
}
.
.
.
runCmd();           //first command, takes 2 minutes to finish
MessageBox.Show("This Should popup only when runCmd() finishes");
</code></pre>
