You should have a Program.cs file in your solution, this file contains a:
static void Main()
{
}
You'll notice in this method there is something like:
Application.Run(new Form1());
This is where your form is actually launched, so what you can do is modify your Main()
to something like this:
static void Main(string[] args)
{
if(args.Length < 1)
{
Application.Run(new Form1());
return;
}
else
{
// Handle your command line arguments and do work
}
}
So if your program is invoked with no command line arguments, the windows form pops open and does its thing. Otherwise you do what you need to do via the command line and exit without ever showing a form.