title: Capture the directory path it uses to run the program
body: <p>I have a C# application which assume it runs from bin directory</p>
  
  <pre><code>string current_directory = Directory.GetCurrentDirectory(); //get current directory, this is the bin dir
  string parent_dir = Directory.GetParent(current_directory).ToString();// this is parent of bin dir
  
  string _Config1 = parent_dir + "\\config\\x.cfg";
  string _Config2 = parent_dir + "\\config\\y.cfg";
  string _Log = parent_dir + "\\log\\z.log";
  </code></pre>
  
  <p>The problem is for some reasons the user can not go to the bin directory and run the app (just type "application_name"). He has to run it using path (ie <code>d:\blah\1\blah\2\blah\3\bin\application_name</code>)</p>
  
  <p>when he does this he gets</p>
  
  <blockquote>
    <p>System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Lo‌​cation)</p>
  </blockquote>
  
  <p>so either I have to capture the path he uses to run the program and use it in my program or somehow make my application to be able to run using path.</p>