tykurez Posted June 6, 2005 Posted June 6, 2005 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! Quote
APaule Posted June 6, 2005 Posted June 6, 2005 Of course there is; you can pass the path as a parameter when you start the app. Quote
tykurez Posted June 6, 2005 Author Posted June 6, 2005 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. Quote
APaule Posted June 6, 2005 Posted June 6, 2005 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 Quote
tykurez Posted June 6, 2005 Author Posted June 6, 2005 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.