Hi,

I have used such method to exec shell command:

protected String ShellExec(
               String cmd,
               String path,
               String parms,
               out int exit_code)
       {
           System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo(
                    path + cmd, parms);
           psi.RedirectStandardOutput = true;
           psi.UseShellExecute = false;

           System.Diagnostics.Process p = System.Diagnostics.Process.Start
(psi);
           string tool_output = p.StandardOutput.ReadToEnd();
           p.WaitForExit();
           exit_code = p.ExitCode;
           return tool_output;
       }


Regards,
Madars.

On 4/23/07, Gazzall <[EMAIL PROTECTED]> wrote:


Hi,

In my C# program I am writing a .sh code.
In this .sh code I have the following command:
java -jar JavaApplication1.jar "/home/user/Debug/Etat/2.jrxml"
"/tmp/Tmp/f021aeb7-0.xml" "/tmp/Tmp/59f34fed-2ada-.xml"

In my c# program a launching the .sh like that:
myProcess = System.Diagnostics.Process.Start("file.sh");
myProcess.WaitForExit();
myProcess.Close();

The problem is that my program does not start the process.

Do you know Why?

Or do you have an idea to execute shell command like
java -jar program ......


Thanks

Gazzall




--
View this message in context:
http://www.nabble.com/Execute-a-shell-program-form-a-C--program-tf3630397.html#a10137289
Sent from the Mono - General mailing list archive at Nabble.com.

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to