Passing Multiple Commadline Args. to Console app from Windows app.

Jan 28 2011 1:25 AM
Hello Friends,

I have a Windows application which calls a Console application and passes 5 command line arguments to that. I'm facing some problem to it.
the console app throughing an exception "Insput string was not in correct format".
 
Following is code:

 string cmdexePath = @"D:\SortProgram\SortProgram\Executable\TS_PD.exe";
            //notice the quotes around the below string...
            string myApplication = cmdexePath + "  " + "D:\\SortedFile.txt D:\\FixFormat.txt "+ " " + GlobalClass.Global.DetPath + "  " + MergeFields +" 10000";
            //the /K keeps the CMD window open - even if your windows app closes
           // string cmdArguments = String.Format("/K {0}", myApplication);
            string cmdArguments = myApplication;
            System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(cmdexePath,cmdArguments);
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo = psi;
            p.Start();

please  reply it's urgent,
thanks.


Answers (3)