Finding the path to your executable

This is a discussion on Finding the path to your executable within the Windows Programming forums, part of the Platform Specific Boards category; I have a program that needs to, under certain circumstances, execute itself and then close. I know the path to ...

  1. #1
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532

    Finding the path to your executable

    I have a program that needs to, under certain circumstances, execute itself and then close. I know the path to the executable but if i put it on a different computer it would change the path and then if those circumstances arose it would not execute itself. Is there some kind of operation that you can call to get the path to the executable? Thanks.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    GetModuleFilenameEx()
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  4. #4
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Ok I thought it was something with the module file name, thanks guys.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can a executable find the path to itself?
    By sulli_jj in forum C Programming
    Replies: 3
    Last Post: 06-23-2006, 12:27 PM
  2. Finding the path of a file
    By caduardo21 in forum C Programming
    Replies: 8
    Last Post: 08-09-2005, 11:00 AM
  3. path finding
    By X PaYnE X in forum Game Programming
    Replies: 27
    Last Post: 05-30-2005, 01:38 AM
  4. Path Finding Using Adjacency List.
    By DeepBlackMagic in forum C++ Programming
    Replies: 7
    Last Post: 05-16-2005, 02:34 PM
  5. Finding the path of an .exe file
    By Gonzo in forum C Programming
    Replies: 1
    Last Post: 09-15-2003, 05:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21