Recently I had to make some minor modifications to a VB.net 2005 application to allow for command line parameters [for scheduler] (Yes, I dabble in .NET still at times, only if I am forced to or someone needs some help… aah, memories.)

Make sure to turn off application framework in the project settings, and make the main sub the startup object. Then if there are no arguments, this will start a new Formclass, otherwise parse parameters.

[vbnet]
Public Shared Sub Main(ByVal sArgs()) As String)
If (My.Application.CommandLineArgs.Count = 0) Then
Application.EnableVisualStyles()
Application.Run(New FormClass)
Else
For Each param as String In My.Application.CommandLineArgs
‘ Do some processing of parameters. i.e. Split by equal sign and get key/value
Dim params() As String = param.Split("=")
Next
End If
End Sub
[/vbnet]