I have a C# Windows Form application. I want to execute another program that is in the same directory with a button click. I only need this code to execute another program.
I have the following code:
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";
}
How can I make this work properly? It is not doing anything right now.
Why are u using a ProcessStartInfo, you need a Process
Process notePad = new Process();
notePad.StartInfo.FileName = "notepad.exe";
notePad.StartInfo.Arguments = "ProcessStart.cs"; // if you need some
notePad.Start();
This should work ;)
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"C:\Scripts\XLXS-CSV.exe";
Process.Start(start);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With