Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Line Parameters 1

Status
Not open for further replies.

arbytech

MIS
Feb 10, 2004
92
US
Let me start by saying that I'm not a programmer but have inherited this since the actual VB guru left the company.

Basically I have a VB6 that needs to call a little command line program and pass some parameters to it. I can get the command line program to launch using the Shell command non problem. And if I code in the parameters those will work.

Can I use a variable in the VB program as a command line parameter in some way? Every attempt I have made using the variables hasn't worked, the VB program sees the variable literaly as the parameter rather than using what ever value the variable has at that time.

If this doesn't make sense or you need more info I am happy to post back (probably tomorrow however, long day already and I need sleep).

Thanks!!
 
Should be straightforward. Post the lines of code where you define your variable and use your Shell

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
Johnwm,

Thanks for your reply. Here is the code:

For pVar = 1 To tmpHolder2(0, 0)
idField = Trim(tmpHolder2(pVar, 7))
mField = Trim(tmpHolder2(pVar, 8))
uField = Trim(tmpHolder2(pVar, 6))
PNum = Trim(tmpHolder2(pVar, 3))
mLen = Trim(tmpHolder2(pVar, 9))
If uField = "all" Then Shell ("C:\program\pct.exe")

I can get the pct command line app to launch when uField=all. However the pct.exe also uses the pnum and mField variables as parameters. That is where I am having problems. When I put the variable within the quotes the pct program treats the actual variable name as the parameter rather than whatever value the variable has at the time.

Any help is appreciated. If you need more info let me know.
 
You probably need something like
Code:
 If uField = "all" Then _
Shell ("C:\program\pct.exe " & PNum & ", " & mLen)
That will place the variable values rather than their names into the shelled program call.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top