Miguel Melo

Miguel Melo

  • NA
  • 3
  • 4.2k

How to run a command line from a running application through c#

Sep 13 2011 3:05 PM
I've searched around and didn't find anything useful! :(

What i want is to have my C# app doing a command to a running process. This running process is a console application and i just need to enter the command "restart".. my try was:


    Process[] processes = Process.GetProcessesByName("OpenSim.32BitLaunch");
    
    foreach (Process p in processes)
    {
         p.StandardInput.WriteLine("restart");
    }


And i get and exectipon: StandardIn not redirected. I've tried to set RedirectStandardInput but nothing :/

Regards


Answers (4)