如何创建exe,我在C#.net中传递参数

我想创建exe文件,因为我想在C#.net中传递参数

例如:myexe.exe“hello”

请帮助

使用命令参数:

  static void Main(string[] args) { if (args.Length > 0) { Console.WriteLine("You Provided " + args[0]); } } 

现在你可以执行myexe.exe“hello”,它将打印出来

你提供了问候

使您的应用程序接收参数

 static void Main(string [] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // the args is the arguments you want to pass to this application Application.Run(); } 

从ac#应用程序调用它

 static void CallProcess(string[] args) { // create a new process Process pro= new Process(); pro.StartInfo.FileName = "exe path"; pro.StartInfo.Arguments = args; pro.Start(); } 

Main()方法有一些参数可以保存你的“你好”:

 static int Main(string[] args) { System.Console.WriteLine(args[0]); //this will output "hello", when you call yourApp.exe "hello" }