Imports System.IO Public Class clsParamsParser Private m_Flatten As Boolean Private m_MakeFillablePDF As Boolean Private m_Input As String Private m_Output As String Private m_IsValid As Boolean Public ReadOnly Property Flatten As Boolean Get Return m_Flatten End Get End Property Public ReadOnly Property InputFile As FileInfo Get Return New FileInfo(m_Input) End Get End Property Public ReadOnly Property IsValid As Boolean Get Return m_IsValid End Get End Property Public ReadOnly Property MakeFillablePDF As Boolean Get Return m_MakeFillablePDF End Get End Property Public ReadOnly Property OutputFile As FileInfo Get Return New FileInfo(m_Output) End Get End Property Public Sub ParamsParser_Initialize() m_Flatten = False m_MakeFillablePDF = False m_Input = String.Empty m_Output = String.Empty m_IsValid = False End Sub Public Function ParseParams() As Boolean Dim al As New ArrayList() Dim thisEnum As IEnumerator Dim flag As Boolean = False For Each param As String In My.Application.CommandLineArgs If Not al.Contains(param) Then al.Add(param) End If Next param Try thisEnum = al.GetEnumerator While thisEnum.MoveNext Dim str As String = thisEnum.Current.ToString.ToLower If str = "/flatten" Then ' The flatten flag was set m_Flatten = True ElseIf str = "/fillable" Then ' Making a PwC fillable m_MakeFillablePDF = True Else ' Assumption is anything else that is passed is the location of the file. 'If System.Uri.IsWellFormedUriString(str, UriKind.Absolute) Then If m_Input Is Nothing Then ' Input is passed first m_Input = str Else ' Output is passed second m_Output = str End If 'End If End If End While Catch ex As Exception End Try If m_MakeFillablePDF Then If m_Input.EndsWith(".zip") Then flag = True End If ElseIf m_Flatten And m_Input.EndsWith(".pdf") Then flag = True End If If File.Exists(m_Input) And Not m_Output = Nothing Then flag = True End If m_IsValid = flag Return flag End Function End Class