Where to store ini files, log files for an application?

Posted on 2008-11-05
Last Modified: 2008-12-11
Where should I be storing any ini files and log files that my application creates and uses?  I've been storing them right in the program's directory under Program Files which I realize now is not optimal - but works until users start using Vista.

So, where should I be storing them so that it will work on Vista and other versions of Windows?  Should the program create a folder in this place or should I have the install program do it?
Question by:davemabe2000
    LVL 54

    Accepted Solution


    You could have your program use the %APPDATA% environment variable to access the AppData folder that is in the User's folder (e.g. c:\Documents and Settings\User\Application Data\).  That variable should work in any OS Windows 2000 and after.  Create your own folder in that folder and store your INI files in it.

    Let me know if you have any questions or need more information.


    Expert Comment

    Actually you never put in a path to the files it uses whatever folder they are currently in, vista or otherwise. So things like:

    StreamReader sr = new StreamReader("settings.ini");

    would read data right from the root folder, regardless of where it is. This works for any OS.
    LVL 54

    Expert Comment

    I'm glad I could help.  I am curious about the B grade though.  Since you never posted a response it would seem my comment was all you needed for an answer.  If that is the case this is complete and should get an A grade.  Please let me know how this turned out and why the grade.  If a mistake was made or you have a question about what grades mean here then let me know.
    Thanks for the fun question.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article ( first and run the tool TDSSKiller ( to get rid of the infection. Once done, and if the …
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    755 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

    19 Experts available now in Live!

    Get 1:1 Help Now