How to execute a .cmd file on confirmation

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top