|
-
March 27th, 2001, 04:49 AM
#1
Command Prompt
Hi
I want to know how can I write a program using VB
that can parse command line parameters.
Thanks
Ehsan
-
March 27th, 2001, 04:57 AM
#2
Re: Command Prompt
Add a Sub Main to your project and use that as startup. In the sub main, there's a variable you can access, namely Command$. This will contain everything wich comes after the exe name.
If you do
myprogram.exe /p /f'myfile.txt'
then Command$ would be
/p /f'myfile.txt'
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
-
March 27th, 2001, 05:02 AM
#3
Re: Command Prompt
in vb, the are some functions which can faciliate the parsing, i.e. inStr, inStrRev, Mid, etc.
If you want a ready one, try
http://vblib.virtualave.net
you can use the GetArg function in the vbSystem class. you need to pass in the command argument as well as the argument no that you required.
for instance, if you argument string is "Dir /ON /S". then when you pass in argument no 2, it will return "/S"
hope this help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|