5

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

0

4 Answers 4

11

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");
Sign up to request clarification or add additional context in comments.

Comments

6

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);

Comments

2

Try this

   ProcessStartInfo startInfo = new ProcessStartInfo();        
   startInfo.FileName = "C:\etc\Program Files\ProgramFolder\Program.exe";
   startInfo.Arguments = "C:\etc\desktop\file.spp C\etc\desktop\file.txt";
   Process.Start(startInfo);

Or you can try the link http://msdn.microsoft.com/en-us/library/aa288457%28v=vs.71%29.aspx

1 Comment

is it a comment or what ? post the answers
1
ProcessStartInfo p = new ProcessStartInfo(@"prg_name", @"args");
Process process = Process.Start(p);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.