I've found this a little hard to find, so I decided to share with you guys.

This small code will allow your app to accept arguments.

Just copy the whole code into the main sub (I didn't tested elsewhere) and edit the code inside the for to do what you want. Voila! It works.

Hope it helps!

Edited 6 Years Ago by RenanLazarotto: n/a

Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs

For i As Integer = 0 To CommandLineArgs.Count - 1
'the message box is just a example. you can make Ifs to check the arguments and do the desired options
MessageBox.Show(CommandLineArgs(i))
Next

The command line argument can be shown in a messagebox like the following

msgbox(command())