Command Line Parser
Description
If you have ever attempted to make a
VB program accept anything beyond the
most basic information from the command line via the
Command function then you will be acutely aware
that the entire system is less than brilliant. There are really two problems - firstly that the
Command
function returns a simple string and not an array of strings, secondly that the
Split function is not
smart enough to understand how delimited separators work. The following addresses those issues.
Hopefully this should help solve some of those problems - this is a Visual Basic module capable of parsing a command
line and turning it into an array of strings. Since it correctly parses delimiters this makes it ideal for
applications which involve handling of multiple long filenames, or for that matter any type of information which
requires VB to accept delimited input via the command line.
Single Compressed Download
Installation & Setup
-
Unpack the zip file into a single directory.
User Guide
Although the test-bed program is commented I will offer some explanation;
CL_Get is the routine
which actually parses the command line, it has a single input - a redimensionable text array which will be returned
containing the separated command line parameters.
The project file as shipped is simply a test-bed application for the module containing
CL_Get, it has
already been pre-configured with a variety of different styles of command line parameter and so simply running the
program through the VB IDE is enough to show you the results of the parsing - in this basic configuration the
test-bed simply enumerates all the parameters which
CL_Get passes back to the debug window.