How to execute a .cmd file on confirmation

  • Thread starter Thread starter Developer
  • Start date Start date
D

Developer

I want to execute "foo.cmd" file on confirmation. My code snippet is

if(MessageBox.Show(cmdQueryArray, "Do You Want To...... ?",
MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName=execArray;
proc.Start();
//proc.StartInfo.Arguments ="firstArg secondArg thirdArg";
}
it gives me compilation error

C:\Symbol\ConsoleExec\Form1.cs(71): The type or namespace name
'Process' does not exist in the class or namespace
'System.Diagnostics' (are you missing an assembly reference?)

Where do I get System.Diagnostics.Process();

Is there any other way I can execute a batch file on confirmation

-Thanks in adnvance
 
Back
Top