C#Form运行外部程序

1:首先先添加命名空间,using System.Diagnostics;

2:调用Process.Start()方法,括号里面写程序路径

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Process.Start(@"C:\Program Files\Tencent\QQ\Bin\QQ.exe");
        }
    }
}

 

 

posted on 2012-07-06 09:10  梦想飞的鱼  阅读(200)  评论(0编辑  收藏  举报

导航