Running a .exe application from Windows Forms

c#, vb.net, visual-c#-express-2010, windows-forms-designer

Solution

You need to use the `Process` class:

Process.Start(@"C:\some_location\myapplication.exe");

For arguments:

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"C:\some_location\myapplication.exe";
startInfo.Arguments = "header.h";
Process.Start(startInfo);

Obviously you can pull these names/arguments from text boxes.

Problem

I have an application that I run on the command prompt as follows: ``` C:\some_location> "myapplication.exe" headerfile.h ``` I want to create a Windows Forms application where the user can specify the location of the executable and also the header file so that the Windows Forms application can do this for him/her, and the user wouldn't have to go to the command line and do it. How can I do this?

Original source