Skip to content

A solution to run other applications through c#

yamid

Asked Nov 4, 2008, 1:14 AM EST1 answer
Share
LinkedInX

If you want to run an application that needs a data file to start you can use the following code:

 

using System;
using System.Diagnostics;

class MyProcessManipulator {
    static void Main(string[] args) {
        Process ieProc = Process.Start(@"exe or Bat file Path ", @"path for file to be read by exe/bat file");

        Console.Write("--> Hit a key to kill {0}...", ieProc.ProcessName);
        try {
            ieProc.Kill();
        } catch { } // In case user already killed it...

    }
}

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    +1
    Good piece of code but it misses something, I let you take a guess
    +1