C#点击按钮执行另一个程序
我有一个C#Windows窗体应用程序,但单击一个按钮,我想执行同一目录中的另一个程序。代码需要做的唯一一件事就是执行另一个程序,不多不少 我有以下代码:C#点击按钮执行另一个程序,c#,C#,我有一个C#Windows窗体应用程序,但单击一个按钮,我想执行同一目录中的另一个程序。代码需要做的唯一一件事就是执行另一个程序,不多不少 我有以下代码: using System.Diagnostics; private void buttonRunScript_Click(object sender, EventArgs e) { System.Diagnostics.ProcessStartInfo start =
using System.Diagnostics;
private void buttonRunScript_Click(object sender, EventArgs e)
{
System.Diagnostics.ProcessStartInfo start =
new System.Diagnostics.ProcessStartInfo();
start.FileName = @"C:\Scripts\XLXS-CSV.exe";
}
我怎样才能使它正常工作,因为它现在什么都没有做?
在前进中,非常感谢
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"C:\Scripts\XLXS-CSV.exe";
Process.Start(start);
您没有调用Start方法和使用Process类。:) 为什么要使用ProcessStartInfo,您需要一个进程
Process notePad = new Process();
notePad.StartInfo.FileName = "notepad.exe";
notePad.StartInfo.Arguments = "ProcessStart.cs"; // if you need some
notePad.Start();
这应该行得通;) 试着去搜索吧,在同一个主题上有很多好的问题和答案!Properties.HasExited和.ExitCode可能很有用。
Process notePad = new Process();
notePad.StartInfo.FileName = "notepad.exe";
notePad.StartInfo.Arguments = "ProcessStart.cs"; // if you need some
notePad.Start();