Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How to know current directory?

Posted on 1999-07-06
Medium Priority
Last Modified: 2010-07-27
I use ini file in my program. But I don't want to put these ini files in \windows directory, I want put these in my program directory or sub-dir of program directory. So what should I do?
Question by:keynes
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 27

Accepted Solution

kretzschmar earned 120 total points
ID: 1386567
hi keynes,

extractfilepath(application.exename);  //get the path where the exe resists

LVL 27

Expert Comment

ID: 1386568
a bit more detailed
MyExePath := extractfilepath(application.exename);  //get the path where the exe resists


Expert Comment

ID: 1386569
If your app was launch by a shortcut?
the initial directory maybe different.
Your data files maybe sited in another location selected by user.
My answer to you is to use GetDir to read the appropriate value and ChDir to change  it to your app path if necessary.

The first answer were you aim ?

T++, Radler.

Expert Comment

ID: 1386570
CurrentDir := ExtractFileDir(ParamStr(0));

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

705 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