Stop Command Prompt from closing so quickly

c#, command-prompt

Solution

try this:

 strCmdText = "/K [enter command stuff here]";

/C Carries out the command specified by string and then terminates

/K Carries out the command specified by string but remains

Problem

I'm trying to troubleshoot why the following function isn't working. ``` public void RunCmd() { string strCmdText; strCmdText = "/C [enter command stuff here]"; System.Diagnostics.Process.Start("CMD.exe", strCmdText); } ``` However whenever I try to run it or throw in some breakpoints, command opens, shows an error, and then closes really quickly (so quickly that I can't read anything). Is there a way I can halt the program or figure out what's going on? Breakpoints don't seem to be working. When I directly type it in Command Prompt instead of running it via this c# script, it the command works fine.

Original source