byCoder
byCoder

Reputation: 9184

Run cmd with parametrs from c# code

Let's say i have button on my form (i use c#)

private void yesButton_Click(object sender, EventArgs e)
{
}

how and what i need to write, so that i can call my ruby cmd file?

for example in cmd i write:

cd c:\ruby\ 
ruby 1.rb 
(here i need to pass some var's) 
root 
123

how can i call this in my c# .net app? also i need to see cmd output on some form component (which is best) ?

also i need to call this in "multi-task", so call this cmd let's say 10 time in ~ on time...

Upvotes: 1

Views: 170

Answers (1)

Mike Perrenoud
Mike Perrenoud

Reputation: 67898

Alright, so you're question is still real vague, but you can do it like this:

var pathToRbFile = @"C:\Ruby193\script\123.rb";
var arguments = string.Empty; // I don't know what the arguments would be

var info = new ProcessStartInfo(pathToRbFile, arguments);
Process.Start(info);

Upvotes: 1

Related Questions