Exe parameter passing (basics for some)

Hi to all

I got a small program that need to pass variables from one to another. Now i want to know how to pass a variable from an apllication to another exe and the other way around aswell if possible. I would apretiate a small working program for testing!! Anyone has an idea???

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cbuenoAuthor Commented:
I believe this would be do using the shell command!!
Pass it like :

Shell "c:\myexe.exe MyVars"

and fetch it like

MyVar = Command()

If you're speaking of standard exes, you can pass parameters while shelling:
shell "c:\myexe.exe parm1,parm2,parm3"
and retrieve them in the shelled pgm using Command$ function:
dim retvar as string
dim parms() as string
But pass parameters back from shelled one to caller is not that easy. A workaround is to make the called write on a file, and the caller readingf the file from time to time (or - using waitforsingleobject Api - make the caller read the file only once the called pgm has ended its job).
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.


Compile this as an exe and run the file with parameters

Private Sub Form_Load()
Dim CommandVars As String
CommandVars = Command()
If CommandVars <> "" Then MsgBox "You typed '" & CommandVars & "' as parameter", vbInformation
End Sub

Happy Programming,
Ayhan Elatik

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cbuenoAuthor Commented:

Cos i am kind of new in this area i have to ask a silly question!!

Now in:  MyVar = Command()

So as what should i declare this variable as???
Does it has to be global???
And if i call it in Form_Load, I just go

Private Sub Form_Load()
MyVar = Command()

End Sub
cbuenoAuthor Commented:
Ok Ayhan Elatik

I got it!!! Easier than i thought!!
Full marks =)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.