help with command line arguments in program - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

help with command line arguments in program

jeffmanjeffman Posts: 112Member
Hello Everyone, It has been a few months since i was last here. Can anyone help me figure out how to code my program so i can get a command line argument out of the code. Here is the code so far i have been attempting to work with so far:
Dim arguments(999) As String
For Each argument As String In My.Application.CommandLineArgs
MsgBox("argument:" + argument)
MsgBox("length of argument:" + argument.Length.ToString, MsgBoxStyle.Information)

now, the argument varible has the command line switch and path together and i want to do case statements. In addition, i want to seperate the command line switch from the argument data. the last sentence is the part i really want to get done though.

Select Case argument
Case Is = "/l=" + argument.Substring(4, argument.Length)
argument = argument.Remove(0, 3)
If argument.Length > 3 Then
inputName = argument
If argument.Length > 3 Then
TimerFileName = argument
MsgBox("filename:" + argument)
End If
End If
Case Is = ""
End Select

MsgBox("argument2:" + inputName, MsgBoxStyle.Information)

'TimerFileName = inputName


If inputName = "" Then
MsgBox("No input name")
MsgBox("Input name: " & inputName)
Sign In or Register to comment.