daljeet
daljeet

Reputation: 99

How to pass command line argument in .net windows application

i want to pass a argument in c#.net to a console application i tried ProcessStartInfo but that can be used for immediate run of an application ... but i want to set the arguments for the application which will run at scheduled time

Upvotes: 1

Views: 1801

Answers (1)

Henrik
Henrik

Reputation: 3704

Use the arguments propery to pass command line arguments

http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.arguments.aspx

Example:

  var info = new System.Diagnostics.ProcessStartInfo();
  info.FileName = "cmd.exe";
  info.Arguments = "/C";
  info.UseShellExecute = true;
  var process = new System.Diagnostics.Process();
  process.StartInfo = info;

  process.Start();
  process.WaitForExit();

Upvotes: 1

Related Questions