В Program.cs
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(args));
}
}
В Form1.cs
public partial class Form1 : Form
{
private string[] mArgs;
public Form1(string[] args)
{
//test run parametr cmd
this.mArgs = args;
InitializeComponent();
if (args.Length > 0)
{
MessageBox.Show(args[0]);
}
}
}
Запуск
> program.exe test
Выведет MessageBox с сообщением test.