Does C# have an equivalent to the system command in C? for example,
how would I do this in c#?.
system("ls -al");
I'm using Mono on Linux.
Does C# have an equivalent to the system command in C? for example,
how would I do this in c#?.
system("ls -al");
I'm using Mono on Linux.
No problem I got it.
public static void system(string command)
{
//No arguments
if(command.IndexOf(' ')== -1)
{
Process.Start(command);
}
else
{
string cmd = command.Substring(0, command.IndexOf(' '));
string args = command.Substring(command.IndexOf(' ')+1);
Process.Start(cmd, args);
}
}
Tested and working on Ubuntu 13.10
You can use Process.Start() method. Look at ProcessStartinfo.UseShellExecute