KillProcess("EXCEL");这是结束一个EXCEL的进程.
运行我就不知道啦!

解决方案 »

  1.   

    this is a whole example ,closeing the process named notepad.exe
    //
    using System;
    using System.Diagnostics;namespace CloseProgram
    {
    /// <summary>
    /// Class1 的摘要说明。
    /// </summary>
    class Class1
    {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    //
    // TODO: 在此处添加代码以启动应用程序
    //
    Process[] myProcesses;
    // Returns array containing all instances of Notepad.
    myProcesses = Process.GetProcessesByName("notepad");
    foreach(Process myProcess in myProcesses)
    {
    myProcess.Kill();
    }
    }
    }
    }
    //
    you can create a console program ,copy all the code ,and build it.
    have a try .
      

  2.   

    若含用户界面,myProcess.Kill()替换为:myProcess.CloseMainWindow();
      

  3.   

    看看这个你用不用得着?
    http://www.codeproject.com/csharp/wmi.asp
      

  4.   

    ProcessStartInfo psInfo = new ProcessStartInfo();
    psInfo.FileName = "net.exe";
    psInfo.Arguments = "send " + strHost + " "+strMsg;//net send
    Process.Start(psInfo);
    启动net send命令的例子。