Hello.
I can't find an Error in your code...except that it's not very .NET like and you should
really turn on Option Strict.
Code:
Dim runType As String = "Weekly"
'---Log the program is beginning and the initial parameters
ArgLogFile = New Log("\\kronos\ProdReptACD\Logs\ArgLogFile.log")
ArgLogFile.Write("Command Arguments: " & My.Application.CommandLineArgs.Count.ToString())
For Each arg As String In My.Application.CommandLineArgs
ArgLogFile.Write(vbTab & My.Application.CommandLineArgs.IndexOf(arg).ToString("N0") & "-" & arg)
Next
'---Set the Run Type to the value of the first parameter passed in.
'---If no parameter was passed, then default to weekly
If My.Application.CommandLineArgs.Count > 0 Then runType = My.Application.CommandLineArgs(My.Application.CommandLineArgs.Count - 1).ToString()
If runType.ToUpper() = "WEEKLY" Then
dtStart = DateAdd("d", -6 - Date.Now().DayOfWeek, Date.Now())
dtEnd = DateAdd("d", -Date.Now().DayOfWeek, Date.Now())
ElseIf UCase(runType) = "CALENDAR" Then
dtStart = "01/01/" & (Date.Now().Year - 1).ToString()
dtEnd = "12/31/" & (Date.Now().Year - 1).ToString()
ElseIf UCase(runType) = "FISCAL" Then
If Month(Now()) > 6 Then
dtStart = "07/01/" & (Date.Now().Year - 1).ToString()
dtEnd = "06/30/" & (Date.Now().Year).ToString()
Else
dtStart = "07/01/" & (Date.Now().Year - 2).ToString()
dtEnd = "06/30/" & (Date.Now().Year - 1).ToString()
End If
End If
Commandline Arguments are simple:
Code:
Your.exe Argument1 Argument2 "This is Argument3" This is not Working
Code:
Argument Array:
0: Argument1
1: Argument2
2: This is Argument3
3: This
4: is
5: not
6: Working
Bobby