Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute a Program Which Accept Command Line Parameters

Tags:

c#

How to Execute a Program Which accepts Command Line Parameters in c#?

like image 699
RnR Avatar asked May 10 '12 08:05

RnR


2 Answers

Use the Start method of the Process class.

Starts a process resource by specifying the name of an application and a set of command-line arguments, and associates the resource with a new Process component.

Example:

Process.Start("IExplore.exe", "C:\\myPath\\myFile.htm");
like image 68
sloth Avatar answered Oct 02 '22 06:10

sloth


ProcessStartInfo Class

ProcessStartInfo is used together with the Process component. When you start a process using the Process class, you have access to process information in addition to that available when attaching to a running process.

ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.Arguments = "www.northwindtraders.com";
  Process process = Process.Start(startInfo);
like image 39
Ravi Gadag Avatar answered Oct 02 '22 06:10

Ravi Gadag