开发者

How to pass command line argument in .net windows application

开发者 https://www.devze.com 2023-04-10 17:03 出处:网络
i want to pass a argument in c#开发者_如何学编程.net to a console applicationi tried ProcessStartInfo

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


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号