1. 程式人生 > >[.Net碼農].net呼叫外部exe檔案

[.Net碼農].net呼叫外部exe檔案

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

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

        private void button1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.FileName = @"D:\Program Files\Wopti\WoptiUtilities_CN.exe";//需要啟動的程式名  
            p.StartInfo.Arguments = "-x  sourceFile.Arj  c:\temp";//啟動引數  
            p.Start();//啟動  
            if (p.HasExited)//判斷是否執行結束  
                p.Kill();

        }
    }
}