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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call exe and pass in parameters

Status
Not open for further replies.

mjlong999

Programmer
Feb 12, 2002
9
US
I normally call an .exe file from the command prompt or using a .bat file, and pass it parameters. I would like to automate this using a vb program.

I have tried the shell visual basic function, but it doesn't seem to handle parameters. I also tried to use the SendKeys function with the shell function to pass in the paramters, but it truncates the data I'm sending in.

Any ideas would be appreciated...

Thanks,

mjlong
 
Hi,

I'm not sure if you mean making a VB program that takes parameters or calling an external progam that take parameters. Anyway both is possible:

Shell works with parameters, try :
--------------------------------------------------
Shell "notepad c:\autoexec.bat"
--------------------------------------------------
to verify.

To pick up the parameters in a vb exe, look in the command$ string:
--------------------------------------------------
Sub Main()
MsgBox "You passed '" & Command$ & "' as parameters to this program."
End Sub
--------------------------------------------------


Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top