Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3690476
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:02:21+00:00 2026-05-19T04:02:21+00:00

Possible Duplicates: Win32: Find what directory the running process EXE is stored in How

  • 0

Possible Duplicates:
Win32: Find what directory the running process EXE is stored in
How to get the application executable name in Windows (C++ Win32 or C++/CLI)?

hi,
i want to make my application run on statup,it uses some of files in the same directory.it works good but when it start at startup the GetCurrentDirectory is “c:\Documents and Settings\User\”..but i want the actual path of the exe file.how i can get it in c++.
please help me.
thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:02:22+00:00Added an answer on May 19, 2026 at 4:02 am

    Try using GetModuleFileName or GetModuleFileNameEx.

    Do this:

    wchar_t exeDirectory[1024]; //to store the directory
    DWORD ret = GetModuleFileName(NULL, exeDirectory, 1024);
    if ( ret )
    {
      /*the path to your EXE is stored in the variable "exeDirectory" - use it */
    }
    

    Note I’m passing NULL as first argument, because MSDN says,

    “If this parameter is NULL,
    GetModuleFileName retrieves the path
    of the executable file of the current
    process.”

    which is what you want. Right?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to get the application executable name in Windows (C++ Win32 or
Possible Duplicate: How to programmatically get DLL dependencies On Windows, in a C++ program,
Possible Duplicates: [.NET] How do I disable a system device? Win32 API function to
Possible Duplicates: C++0X when? When will C++0x be finished? When will C++0x be released?
Possible Duplicate: error: Unable to find vcvarsall.bat I'm trying to install MySql interface for
Possible Duplicate: Is there a way to the hide win32 launch console from a
Possible Duplicate: Accessing Password Protected Network Drives in Windows in C#? I have ComputerA
Possible Duplicates: Why use ++i instead of i++ in cases where the value is
Possible Duplicates: How do I convert an InputStream to a String in Java? In
Possible Duplicates: Why is it bad to use goto? GOTO still considered harmful? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.