创建和销毁子进程

using System;
using System.Diagnostics;
using System.Threading;

namespace program
{
    class wangjun
    {
        static void Main()
        {
            //创建一个记事本的子进程,记事本的文件名为 hello.txt
            Process pp = Process.Start("notepad.exe", "hello.txt");
            //线程等待5秒
            Thread.Sleep(5000);
            //结束子进程
            pp.Kill();
            Console.WriteLine("结束子进程");
            Thread.Sleep(5000);
            Console.WriteLine("主进程结束");
        }
    }
}

你可能感兴趣的:(创建和销毁子进程)