How to pass parameters between 2 exe files by command prompt or other ways

Posted on 2005-04-20
Last Modified: 2013-11-20
Hi Experts,

May I know how to pass parameter between 2 exe files.
I need a sinple way, such as command prompt.
May you give any sample code?

Thanks and Regards,

Question by:turbot_yu
    LVL 1

    Assisted Solution

    LVL 3

    Assisted Solution

    its easy:

    in c++ you can either use system(p.exe arglist)
    or CreateProcess(exename, arg, ..)

    LVL 43

    Assisted Solution

    Between two running apps look at the WM_COPYDATA in help.  It has a link to example code.
    LVL 50

    Assisted Solution

    by:Julian Hansen
    You have cross posted this to

    This is not considered to be a good idea by the EE community.

    What you should do is post a pointer question (20 pts) to the main question and refer people there. This way you cause confusion.

    Author Comment

    sorry, i am not sure where is more protable to post
    LVL 50

    Assisted Solution

    by:Julian Hansen
    You can post to multiple threads but what you need to do is make one of the threads the primary - that is the one you offer the majority of points for.

    You can then post what is called pointer questions in other relevant threads that refer to the main question (cut and past the URL from the main question to the pointer question). Allocate 20pts for the pointer and state that it is a pointer to another question.

    This way you can get the discussion for the question in a single thread.

    LVL 1

    Accepted Solution

    Register a windows message, then use FindWindow to locate a handle to the window of each app.  Set up a shared memory area.  Post a message like WM_DATAAVAILABLE.  When an app gets the message they check the shared memory area for the data.

    Or if the data you are trying to send is small, the standard way is to use windows sockets.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
    Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now