Howdy, Stranger!

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


help with command line arguments in program

jeffmanjeffman Member Posts: 112
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.