Retry Retry - 1 year ago 81 Question

Running a .exe application from Windows forms

I have an application that I run in the command prompt as follows:

C:\some_location>"myapplication.exe" headerfile.h

I want to create a Windows form application where the user can specify the location of the executable and also the header file so that the windows form can do this for him and the user wouldn't have to go to the command line and do it.

I'm very new to C#, so can anyone please help me out? Thank you!

Answer Source

You need to use the Process class:


For arguments:

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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download