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

  • Home
  • SEARCH
  • 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 6579839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:56:54+00:00 2026-05-25T15:56:54+00:00

I had this console application. Now i have added Environment variable PATH to its

  • 0

I had this console application. Now i have added Environment variable PATH to its setup so that it can be executed from any location through Console. Strangely, the same application is breaking after this change.

Installation directory contains, BIN and CONFIG folder. Exe is placed inside BIN folder.

I have this line of code,

WriteToFile(@"..\Config\Settings.xml")

The path used to write to a file Settings.xml inside Config folder inside the INSTALLATION DIRECTORY. However, now it tries to write to settings.xml inside Config folder at EXECUTION PATH.

So, if i execute my app from console as c:/users/guest/app.exe, it would try to interpret path relative to this location AND NOT relative to installation directory for the application.

Any help, suggestions?

  • 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-25T15:56:55+00:00Added an answer on May 25, 2026 at 3:56 pm

    Get the path of the executing assembly then add to it the folder and file name:

    string pathOfExecutingAssembly = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
    string settingsPath = pathOfExecutingAssembly + "\\..\\Config\\Settings.xml"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had this nasty bug that disappeared in the past but now after quite
I had this doubt for sometime now, some people say that there's no such
I have a console application that allows the users to specify variables to process.
I have a powershell script that runs a console .exe application. The console application
I have setup an Application that uses @Anywhere from twitter to Authenticate the users.
I had this problem before and can't for life of me remember how to
I had this error when I browse new web site that site sub from
i had a gps into my application that worked well for a time and
I've been searching and experimenting for a while with this, but I have had
I have a fairly intensive application, which I've just converted from a console application

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.