Process p= new Process();p.StartInfo.FileName = "demo.exe";p.StartInfo.Arguments = "a b";p.Start();
要么
Process.Start("demo.exe", "a b");在demo.exe中
static void Main (string [] args){ Console.WriteLine(args[0]); Console.WriteLine(args[1]);}您问如何保存这些参数。您可以创建具有静态属性的新类,然后将这些参数保存在那里。
class ParamHolder{ public static string[] Params { get; set;}}和主要
static void Main (string [] args){ ParamHolder.Params = args;}在程序的任何位置获取参数:
Console.WriteLine(ConsoleParamHolder.Params[0]);Console.WriteLine(ConsoleParamHolder.Params[1]);
等等



