Wednesday, October 30, 2013

Running Exe with Arguments with write action using C#

Hi All,


I need to do an action that can be acheived by executing the following command in command prompt:


"exe file" "Input file" >"OutputFile"


which means I am writing the data into the second argument file.


Now for the same I am trying to do the same in C# coding as displayed below, but its not working.


Process myProcess = new Process();

myProcess.StartInfo.UseShellExecute = true;

myProcess.StartInfo.FileName = @"""E:\aa ePUb-XML\xmlvalid.exe""";

myProcess.StartInfo.Arguments = String.Format("\"{0}\" >\"{1}\"", @"E:\aa ePUb-XML\Test Files\45644.xml", @"E:\aa ePUb-XML\Test Files\Log.xml");

myProcess.StartInfo.CreateNoWindow = true;

myProcess.Start();

myProcess.WaitForExit();

myProcess.Close();



Any help/Suggestion appriciated.


Thanks,


Christober


No comments:

Post a Comment