|
-
Mar 4th, 2003, 09:25 AM
#1
Thread Starter
Lively Member
Solved -- Call exe file with parameter
Hi,
I am new in VB. I saw someone call a vb exe file with two parameters like "exefile response.asp c:\request.txt". I just wonder how this exefile handle those two parameters. I mean what methods should be used to handle parameters in vb.
Thanks for help in advance!
Claire
Last edited by claire99; Mar 4th, 2003 at 11:30 AM.
"And we know that all things work together for good to them that love God,
to them who are the called according to his purpose. " --- Romans 8:28
-
Mar 4th, 2003, 09:32 AM
#2
The command line can be read with the Command$ function.
eg
VB Code:
Private Sub Form_Load()
MsgBox Command$
End Sub
To test this in the IDE, you can specify commandline parameters in the Project --> Project Properties --> Make tab --> Command Line arguments
-
Mar 4th, 2003, 09:48 AM
#3
Thread Starter
Lively Member
Thanks, Frans C.
I'd like to test it. But could please also tell me how to call an exe file with parameters in VB.
"And we know that all things work together for good to them that love God,
to them who are the called according to his purpose. " --- Romans 8:28
-
Mar 4th, 2003, 09:55 AM
#4
Thread Starter
Lively Member
Sorry, Frans C
I didn't notice you've already told me how to test it.
Thanks.
"And we know that all things work together for good to them that love God,
to them who are the called according to his purpose. " --- Romans 8:28
-
Mar 4th, 2003, 09:59 AM
#5
Frenzied Member
To run an executable from a VB program, you use the Shell command.
Something like:
Shell "C:\Test\MyProg.exe Param1 Param2"
-
Mar 4th, 2003, 10:44 AM
#6
Thread Starter
Lively Member
Thanks, JordanChris and Frans C. Both of your ways work.
One more thing, I know if I want to get the parameters I can use
Code:
Dim cmds as String
cmds = Command
then I can get both param1 and param2. But how can I get param1 and param2 seperatly? Do I have to using a loop to seperate them?
Thanks.
"And we know that all things work together for good to them that love God,
to them who are the called according to his purpose. " --- Romans 8:28
-
Mar 4th, 2003, 10:49 AM
#7
Because you write the program, you can decide how the parameters should look like. Look up the Split function, and the InStr function in the help file. I think you need them.
-
Mar 4th, 2003, 10:58 AM
#8
Thread Starter
Lively Member
"And we know that all things work together for good to them that love God,
to them who are the called according to his purpose. " --- Romans 8:28
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
|