I have a console application that asks for a SourcePath when started.. when I enter the Source Path, It asks for DestinationPath… when i enter DestinationPath it starts some execution
My Problem is to Supply these path via a windows application, means i need to create a window form application that will supply these parameters to the console application automatiocally after certain time interval
can it be achieved or not… if yes, plese help… its very Urgent…
ohh..
I have tried a lot of code that i can not paste hear all but some that i use to start the application are…
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"C:\Program Files\Wondershare\PPT2Flash SDK\ppt2flash.exe";
psi.UseShellExecute = false;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.CreateNoWindow = false;
psi.Arguments = input + ";" + output;
Process p = Process.Start(psi);
and
Process process = new Process
{
StartInfo = new ProcessStartInfo
{
CreateNoWindow = true,
FileName = @"C:\Program Files\Wondershare\PPT2Flash SDK\ppt2flash.exe",
RedirectStandardError = true,
RedirectStandardOutput = true,
UseShellExecute = false,
}
};
if (process.Start())
{
Redirect(process.StandardError, text);
Redirect(process.StandardOutput, text);
MessageBox.Show(text);
}
private void Redirect(StreamReader input, string output)
{
new Thread(a =>{var buffer = new char[1];
while (input.Read(buffer, 0, 1) > 0)
{
output += new string(buffer);
};
}).Start();
}
but nothing seems to be working
You can add parameters to your ProcessStartInfo like this:
this will startup the console app with 2 parameters.
Now in your console app you have the
the string array args is what contains the parameters, now all you have to do is get them when your app starts.
This may or may not be the exact code that you need, but at least will give you an insight in how to accomplish what you want.