run command prompt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bassem
    Contributor
    • Dec 2008
    • 344

    run command prompt

    Hi

    I'm trying to run a simple command prompt "help". But the command prompt opens and no command runs!

    Code:
    string strCmdText;
    strCmdText = "help";
    System.Diagnostics.Process.Start("CMD.exe", strCmdText);
    I appreciate your help.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Try using ProcessStartInf o and redirecting the output of the process to the console so you can see what's going on.

    Comment

    • Bassem
      Contributor
      • Dec 2008
      • 344

      #3
      Thank you r035198x. But I wanted to run a regular console window that users can interact with from outside my application.

      I found that sending a command as an argument to "cmd.exe" does not mean that it should execute it. We have to lead the command with one of these instructions:

      /c means execute then terminate.
      /k means execute and wait for a user input.

      Comment

      Working...