parsing the command line arguments

How do you read values passed as a command line argument in vb6 applications. the application would be called like shown below. I would like to get the three arguments that are passed with the exe. How do i do that vb 6. thanks in advance.

C:\parser.exe JU1991020005 940604707218.txt  940604707218.idx
LVL 3
sony1464Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

[ fanpages ]IT Services ConsultantCommented:
Hi,

Query the Command$ variable in your VB code.

In the above example, it will contain "JU1991020005 940604707218.txt  940604707218.idx".

BFN,

fp.
0
ampapaCommented:
I think you can get by using the command function.

sub frmmain_load()
   frmmain.text1 = command
end sub
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

hesCommented:
Sub Form_load()
  Dim CommandArgs
  CommandArgs = Split(Command(), " ")
  'CommandArgs(0) will contain your first argument
  'CommandArgs(1) will contain your second argument
  'ect
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sony1464Author Commented:

i tried hes's example and it worked great .... now how do i get the filename without the extension from the second argument and save it in the application diresctory as filaname.doc...i really appreciate such a quick reponse....

for the above example i want a file called 940604707218.doc to be created in the application directory.
0
ampapaCommented:
Assuming your still using the above, untested.

Sub Form_load()
  Dim CommandArgs
  Dim cmdFilename as string

 
  CommandArgs = Split(Command(), " ")
  CommandArgs(0) will contain your first argument
  CommandArgs(1) will contain your second argument
   cmdfilename =  left(CommandArgs(1), len(CommandArgs(1))-3)

   Open app.path & "\" & cmdfilename & "doc" For output As #1
         Print #1, "File created."
   Close #1
   

End Sub
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.