调用外部EXE文件

Posted on 2019-01-26 14:06  努力成长静待花开  阅读(198)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  Process类的Start方法

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = "EXE文件(*.exe)|*.exe";
            if (open.ShowDialog() == DialogResult.OK)
                textBox1.Text = open.FileName;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start(textBox1.Text);
        }