4
Reply

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

Miguel Melo

Miguel Melo

Sep 13 2011 3:05 PM
3.3k
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)