Solved

How do I read an .ini-file with a Win service on Windows7

Posted on 2010-11-24
2
326 Views
Last Modified: 2012-05-10
I have installed my Service and the .exe-file is located in C:\Program Files (x86)\MyService. I want to read some values from a .ini-file that also should be located in the same folder.

I have previously used the following code to  read file in the same folder as the service exe-file : path = Environment.CurrentDirectory + "\\Mysettings.ini";

When I debug the service I can see that Mysettings.ini must be located in c:\windows\syswow64 to get it to work. What other code than  Environment.CurrentDirectory should I use to get the right path ?
0
Comment
Question by:Mackey_man
[X]
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 Comments
 
LVL 5

Accepted Solution

by:
buraksarica earned 500 total points
ID: 34206304
try AppDomain.CurrentDomain.SetupInformation.ApplicationBase
0
 

Author Comment

by:Mackey_man
ID: 34206421
Thanks a lot !
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
linq, c# 8 34
asp web application 3 42
insert an Jpeg/bmp image onto the visio drawing using VBA/C# 5 25
C# DataTable (in memory) vs SQL Lookups 4 36
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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