|
-
Nov 15th, 2000, 04:09 PM
#1
Thread Starter
Fanatic Member
Hey I was wondering if any of you know how to use the command function to call an exe and then place arguments like in DOS behind it?
-
Nov 15th, 2000, 04:17 PM
#2
Command$ is simply used to retrieve the command line argument.
For example, if in the prompt, you type: MyApp.exe prompt, Command$ will return "prompt".
In your case, if you want to open an EXE, use:
-
Nov 15th, 2000, 04:22 PM
#3
Addicted Member
Are you wanting to execute a different program from within your own, or are you wanting to gather command line parameters to use within your application?
If you want to call another program you can use the Shell function.
Code:
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", vbNormalFocus) ' Run Calculator.
If you want to get command line parameters for your application use the Command function.
Code:
Dim CmdLine
CmdLine = Command()
I hope this is what you were looking for.
Michael Woolsey
Application/Web Developer
Visual Basic 6.0 SP5
Active Server Pages
Oracle 9i
- I'm going to live forever, or die trying!
-
Nov 15th, 2000, 04:24 PM
#4
Thread Starter
Fanatic Member
And what would yuou do to pass the arguments? When I try to pass them it just opens the app opens the exe and then does not pass the arguments.
Example:
dim str as string
str = "-argument argument"
shell(app.exe str), vbmax
-
Nov 15th, 2000, 04:44 PM
#5
Thread Starter
Fanatic Member
Thanks for the help, what I want to do is call another program, it is a dos app. I then want to pass the arguments into it. Such as
shell(app.exe -argument argument)
When I call the Dos app it just does the exe and then does not place the arguments in their.
Any suggestions?
I don't need to use the shell this is all I know.
-
Nov 15th, 2000, 04:54 PM
#6
Thread Starter
Fanatic Member
-
Nov 15th, 2000, 06:23 PM
#7
Thread Starter
Fanatic Member
-
Nov 15th, 2000, 07:26 PM
#8
Member
"/"
i understand you only desire to send information ( or in other words : parameters ) to a dos program...
if so ..the command$ function would be useless to you because it's use only in handy from within vb.
the reason your parameters didn't work , is because you forgot the "/" mark
if you want to call a program : "c:\autoturbo.exe"
then you need to write this : shell(..."c:\autoturbo.exe" /p)
notice the "/p"
this might tell the program to print something or whatever
go it?
then again , i dont know how dos programs translates the parameters .. and that's why i'm not possitive about what i'm telling ya..but try it out ...maybe it'll work
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
|