[Gtk-sharp-list] Executing Shell commands

Zaizeku zaizeku at gmail.com
Sun Jun 7 20:36:46 EDT 2009




Matt Guo wrote:
> 
> Hey, Zaizeku,
> 
> The "rm" is the command, and the "-r /home/zaizeku/Desktop/test.txt"
> is the arguments.
> 
> So following code shall be work:
> 
> ...
> pipes.StartInfo.FileName = "rm";
> pipes.StartInfo.Arguments = "-r /home/zaizeku/Desktop/test.txt";
> ...
> 
> Moreover, if you want to execute a complex command, I think "sh" (i.e.
> /usr/bin/sh) would be better than "gnome-terminal",
> and  the code would be:
> 
> ...
> Process pipes = new Process();
> string command = "rm -r /home/zaizeku/Desktop/test.txt";
> string tmpScript = "/tmp/cmd.txt";
> File.WriteAllText(tmpScript , command);
> pipes.StartInfo.FileName = "sh";
> pipes.StartInfo.Arguments = tmpScript ;
> pipes.Start();
> ...
> 
> BTW,  ur question is not related to gtk-sharp, I think the mono
> mail-list is a better place to ask such question.
> 
> B.R.
> Matt
> 

Thank you so much you solved my problem, and sorry I thought the question
was relevant here, well anyway thanks for taking your time to actually
answer my question I really appreciate it =)

-- 
View this message in context: http://www.nabble.com/Executing-Shell-commands-tp23904222p23916824.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list