I'm new to console applications

metalgarth

New member
Joined
Aug 18, 2004
Messages
1
Programming Experience
3-5
Hello,

I have succesfully written a small application that runs. How do I incorporate command line parameters? The application takes the name of a data file (hard coded) and parses it into parameters for an sql INSERT command. What I want is for the user to enter the name of the program at a DOS prompt followed by the name of the file. example: parser "filename.txt"

What steps do I need to follow to accomidate this????
 
command line arguments can be found in the property Environment.GetCommandLineArgs() this will return an array of type String. the first argument is the location of the executable the second and so are you're parameters.

Example:

in the command line you enter: c:\Parser filename.txt

dim params as String() = Environment.GetCommandLineArgs()

then your params(0) = c:\Parser.exe
and params(1) = filename.txt
 
Back
Top