title: Why is the working directory the directory of the executable and not where I'm running from?
body: <p>I'm running my console app from a plain old command prompt. I'm running it two ways:</p>
  
  <ol>
  <li><p>using a relative path to the executable from what I think is the working directory. i.e.</p>
  
  <p><code>C:\Working&gt;.\path\to\my.exe -fileToRead file.txt</code></p></li>
  <li><p>using a folder in my $PATH$. I.e.</p>
  
  <p><code>C:\Working&gt;my.exe -fileToRead file.txt</code></p></li>
  </ol>
  
  <p><code>file.txt</code> is in <em>C:\Working</em> and <code>my.exe</code> is <em>C:\Working\path\to</em>. <code>my.exe</code> will output an XML log file to the working directory. In my mind that, that should be C:\Working, but the file actually ends up in <em>C:\Working\path\to</em>. This doesn't jive with <em>all other</em> command line applications.</p>
  
  <p>I'm not doing anything weird or non-standard (that I know about). I've tried just using the file name for the XML file, <code>"TestResult.xml"</code> and also <code>Path.Combine(Environment.CurrentDirectory, "TestResult.xml")</code>. Both end up in the executable directory, not the directory from which I'm running. The command-line parameter file argument is being read properly, so I know that's working.</p>
  
  <p><strong>Clarification:</strong> Basically, my problem is that <code>Environment.CurrentDirectory</code> and <code>Assembly.GetExecutingAssembly().Location</code> are the same directory, but shouldn't be.</p>
  
  <p>What am I doing wrong here? And how do I get the directory from which I execute, not the path to the executable? (I realize I have the exact opposite problem of many questions on stackoverflow)</p>