Reputation: 89
I have been trying to start a .exe file which will ask further 4 different inputs but how can i pass these inputs as parameters. I have added these parameters as a string separated by a space in starting the new process but it didn't work? Could anyone help me to find out the solution?
String[] parms = { "1 1 Inputfile.cor Outputfile.dat" };
using (Process execProc = Process.Start("spi_sl_6.exe", String.Join(" ", parms)))
{
execProc.WaitForExit();
}
Upvotes: 1
Views: 1211
Reputation: 89
Finally, I made the solution. I created .bat file as follow:
(
echo 1
echo 1
echo Inputfile.cor
echo Outputfile.dat
) | spi_sl_6.exe
Then executed with
Process.Start("___.bat");
Upvotes: 1
Reputation: 2714
Use the ProcesStartInfo class.
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "spi_sl_6.exe";
psi.Arguments = "1 1 Inputfile.cor Outputfile.dat";
Process p = Process.Start(psi);
UPDATE: If I'm reading the comments above correctly, this won't help you. As it was said, there's no way to "automagically" plug values into the UI.
Upvotes: 2