1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Launch exe with parameters from a file?

Discussion in 'C' started by daveyah2002, Mar 18, 2011.

  1. daveyah2002

    daveyah2002 New Member

    Joined:
    Mar 18, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    My first post.
    A general query.

    I wish to launch an executable from a file associated with the program. However I need to lauch it with a parameter from the file I am double-clicking on.

    Double-clicking a file is just telling Windows which program to launch it with but is this an accessible process?

    Is this feasible?



    Thanks.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    Yes. Any application like a notepad is associated with the .txt files and this is because Windows sends the file name in parameter which is opened by the application.
     
  3. daveyah2002

    daveyah2002 New Member

    Joined:
    Mar 18, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi, Thanks for the response - not quite what I am after. I know the file is already associated with the program like Notepad launches when you double click a .txt file as in your example.

    I want my application to launch with say a command line parameter so it opens in a specific way. The parameter I want to use it would extract from the file I double-click on. So 2 different files could launch the application in a different mode.

    Is this possible?
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    Yes why not.
     
  5. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Yes, but what you would have to do is have the program parse that file for the parameter.

    Or you could create a new program that parses the file, then launches the first program with the file and the parameter.
     

Share This Page