天天看點

c#啟動本機程式

  寫一段簡單的程式啟動本機上的程式,千千靜聽,IE或者電腦。覺得挺有意思的。初學,和大家分享一下。我是使用的控制台應用程式

首先添加命名空間:

using System.Diagnostics;

namespace 控制台

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.WriteLine("please input :1-千千靜聽,2-IE,3-電腦");

            int cmd = Console.Read();

            if (cmd == 49)

                Process.Start("TTPlayer.exe");

            else if (cmd == 50)

                Process.Start("IEXPLORE.EXE");

            else if (cmd == 51 )

                Process.Start("Calc.exe");

            Console.ReadLine();

        }

    }

}

    本文轉自 陳敬(Cathy) 部落格園部落格,原文連結:http://www.cnblogs.com/janes/archive/2008/07/23/1249636.html,如需轉載請自行聯系原作者