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.
Loading
Suthish NairPosted Jan 30, 2011, 1:30 PM
So other members can easily find the answers.
Sam HobbsPosted Jan 28, 2011, 3:17 PM
Note that you are passing cmdexePath twice; once in myApplication and again in the ProcessStartInfo. My guess is that you don't need to pass cmdexePath in myApplication. One more thing; you might need to have double quotes around the filenames in the parametrs that the console program "sees".
Suthish NairPosted Jan 28, 2011, 5:05 AM
static void Main(string[] args)