Console Application deployment

tykurez

Newcomer
Joined
Jun 6, 2005
Messages
3
Location
Connecticut
I have a console application which is going to run on a server that searches a directory for any post-script files and converts them to .pdf files. Currently the directory it searches is 'hard-coded' in the app.config file, but when I deploy this I want the client to be able to 'pass' a directory name for it to search in. Is there any way to do this with a console application? Thanks in advance for any help!
 
APaule said:
Of course there is; you can pass the path as a parameter when you start the app.

Right, so say I do something like:

"Ps2PdfConversionTool.exe" \\sourceDirectory\

What do I use to access the directory name? args(0)? Thanks.
 
Visual Basic:
Public Sub Main(ByVal Args() As String)
  If Args.Length > 0 Then
    'validate argument and if correct start the task - Args(0) contains the path
  Else
    Console.WriteLine("Arguments missing")
  End If
End Sub
 
APaule said:
Visual Basic:
Public Sub Main(ByVal Args() As String)
  If Args.Length > 0 Then
    'validate argument and if correct start the task - Args(0) contains the path
  Else
    Console.WriteLine("Arguments missing")
  End If
End Sub

Yeah just tried it and it works. Thanks for your help :)
 
Back
Top