0

I opened a Command Prompt in my system and I'm passing some series of commands to it using System.Windows.Forms.SendKeys.Send(key); method.

Now is it possibel to get the status of command prompt that means whether it is executing command or it is in idle state and how to know which command it is executing at particular time?

Jones
  • 1,480
  • 19
  • 34
arun
  • 57
  • 2
  • 9
  • 9
    out of plain curiosity, why don't you use just `Process.Start`? – Vlad Jul 20 '12 at 09:18
  • You would be better using a batch file, then you wouldn't need to worry about that. – Bali C Jul 20 '12 at 09:20
  • Use [`Process.StandardInput`](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardinput.aspx) and [`Process.StandardOutput`](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx), don't use SendKeys. – Alvin Wong Jul 20 '12 at 09:23

1 Answers1

0

Use StartInfo.RedirectStandardOutput See this post:

Piping in a file on the command-line using System.Diagnostics.Process

Community
  • 1
  • 1
Ria
  • 10,237
  • 3
  • 33
  • 60