Running a .exe application from Windows Forms
35,444
Solution 1
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.
Solution 2
You can try with this code:
ProcessStartInfo startInfo = new ProcessStartInfo("yourExecutable.exe");
startInfo.Arguments = "header.h"; // Your arguments
Process.Start(startInfo);
Author by
Retry
Updated on September 13, 2020Comments
-
Retry almost 4 years
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?