What you can do is edit the Main method of your WinForms application and if you receive a certain command-line argument, say
/checkOnly
, then only call the StringFormat_check method:
[STAThread]
static void Main(string[] args)
{
if (args.Length > 0 && args[0] == "/checkOnly")
{
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
And from your batch file, call your application like this:
YourWinFormsApp.exe /checkOnly <maybe other arguments here if needed>