When you search for a way of executing a command-line-tool or the command-prompt, you find too many results like this question, this question or this article. They all contain solutions to the exact same issue. However, the program I'm currently working on has to execute a command-line-tool almost 500 times. When I do the following:
for (int i = 0; i < 500; i++)
{
Process.Start("cmd","My Input: " + i);
}
The computer stops responding for a while because too many programs got opened at the same time.
When I do the following:
for (int i = 0; i < 500; i++)
{
Process.Start("cmd","My Input: " + i);
System.Threading.Thread.Sleep(myInterval);
}
The program takes too much time to get the job done(I got no problem if my program hangs while executing those commands).
From my point of view, the main reason all this happens is that I keep opening another cmd window each time I run a tool. Could I keep a single cmd window open and keep feeding it commands till I am done? Is there a more efficient way of doing that?