Absolutely no C# experience here but been asked to edit a Windows Form Application and got a little stuck!
Upon clicking a button on the form the following coding runs:
private void RunHPPreSort_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("cmd.exe", @"/k C:\Program Files\Hewlett-Packard\HP Exstream\HP Exstream 8.0.310\Engine.exe");
}
This works fine but I need to add in an arguments to allow Engine.exe to grab settings for a control file. I have tried changing the code to:
private void RunHPPreSort_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("cmd.exe", @"/k C:\Program Files\Hewlett-Packard\HP Exstream\HP Exstream 8.0.310\Engine.exe -CONTROLFILE=C:\Users\adam.pope\Desktop\Accenture\Control Files\Accenture Control File Step One.opt");
}
I did this because running C:\Program Files\Hewlett-Packard\HP Exstream\HP Exstream 8.0.310\Engine.exe -CONTROLFILE=C:\Users\adam.pope\Desktop\Accenture\Control Files\Accenture Control File Step One.opt
directly from the Command Line works perfectly. However when I use it through the Windows Form Application I get the following error in the on the Command Line:
'C:\Program' is not recognized as an internal or external command, operable program or batch files.
It seems that adding the "-" in before the arguments is causing the problem but this is the only way in which Engine.exe
will accept arguments.
Is there a solution to this? Sorry if it is blindingly obvious but I have no idea what I'm doing in the C# world!