[Mono-list] command

Fabian fseoane@wanadoo.es
Mon, 09 Aug 2004 15:15:13 +0200


--=-oDiGK8iAjJuy2YIjMhJ6
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi!. If i'm not wrong, if i want to execute a shell command like "ls
-lh" I must paste the following code: 

            System.Diagnostics.Process proc = new
System.Diagnostics.Process(); 
            proc.EnableRaisingEvents=false;
            proc.StartInfo.FileName= "ls"; 
            proc.StartInfo.Arguments = "-lh"; 
            proc.Start(); 
            proc.WaitForExit(); 

The problem is that it doesen't work unless i'm root. Otherwise I get: 

Unhandled Exception: System.ComponentModel.Win32Exception: Cannot find
the specified file
in <0x00657> System.Diagnostics.Process:Start_common
(System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process)
in <0x0003d> System.Diagnostics.Process:Start
(System.Diagnostics.ProcessStartInfo)
in <0x00029> System.Diagnostics.Process:Start (string)
in <0x0000f> prueba:Main ()


Is there a way to execute a shell command without being root ?
Thanks.

--=-oDiGK8iAjJuy2YIjMhJ6
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
Hi!. If i'm not wrong, if i want to execute a shell command like &quot;ls -lh&quot; I must paste the following code: <BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.Diagnostics.Process proc = new System.Diagnostics.Process(); <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proc.EnableRaisingEvents=false;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proc.StartInfo.FileName= &quot;ls&quot;; <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proc.StartInfo.Arguments = &quot;-lh&quot;; <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proc.Start(); <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proc.WaitForExit(); <BR>
<BR>
The problem is that it doesen't work unless i'm root. Otherwise I get: <BR>
<BR>
Unhandled Exception: System.ComponentModel.Win32Exception: Cannot find the specified file<BR>
in &lt;0x00657&gt; System.Diagnostics.Process:Start_common (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process)<BR>
in &lt;0x0003d&gt; System.Diagnostics.Process:Start (System.Diagnostics.ProcessStartInfo)<BR>
in &lt;0x00029&gt; System.Diagnostics.Process:Start (string)<BR>
in &lt;0x0000f&gt; prueba:Main ()<BR>
<BR>
<BR>
Is there a way to execute a shell command without being root ?<BR>
Thanks.
</BODY>
</HTML>

--=-oDiGK8iAjJuy2YIjMhJ6--