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?
Printable View
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?
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:
Code:Shell Command$, 1
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.
If you want to get command line parameters for your application use the Command function.Code:Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", vbNormalFocus) ' Run Calculator.
I hope this is what you were looking for.Code:Dim CmdLine
CmdLine = Command()
Michael Woolsey
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
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.
Anymore suggestions?
Anymore ideas?????????
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