I have some code that launches an external program, although is it possible to specify the working directory, as the external program is a console program:
Code:
private void button5_Click_2(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@"update\update.exe");
}
In Windows to execute a program, double-click the executable file or double-click the shortcut icon pointing to the executable file. If you have a hard time double-clicking an icon, click the icon once to highlight it and then press Enter on the keyboard.
Yes, it's possible, use ProcessStartInfo
object to specify all the params you need and then just pass it to the Start
method like that:
...
using System.Diagnostics;
...
var psi = new ProcessStartInfo(@"update\update.exe");
psi.WorkingDirectory = @"C:\workingDirectory";
Process.Start(psi);
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