mkrisz
asked on
Start a proccess from C# in the background
Dear Eperts,
I would like to start an external command line application from csharp. I have already found a code to do that, but when I run it, it runs the "external" cmd proccess in front of me (like when I start it from cmd.exe). I would like to ask you to show me a code which I can use for running this application with it's arguments, but in the background. So I don't want to see any command line interface popping up. Please, if you have any suggestions to do that, post it to me.
Thank you really much,
Chris
I would like to start an external command line application from csharp. I have already found a code to do that, but when I run it, it runs the "external" cmd proccess in front of me (like when I start it from cmd.exe). I would like to ask you to show me a code which I can use for running this application with it's arguments, but in the background. So I don't want to see any command line interface popping up. Please, if you have any suggestions to do that, post it to me.
Thank you really much,
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Lenordiste, you forgot the arguments, but I did that, so no problem :) Great solution, thanks.
public static int ExecuteCommand(string Command, int Timeout)
{
int ExitCode;
ProcessStartInfo ProcessInfo;
Process Process;
ProcessInfo = new ProcessStartInfo("cmd.exe"
ProcessInfo.CreateNoWindow
ProcessInfo.UseShellExecut
Process = Process.Start(ProcessInfo)
Process.WaitForExit(Timeou
ExitCode = Process.ExitCode;
Process.Close();
return ExitCode;
}