title: Directory.GetCurrentDirectory() returns different results based on command line arguments
body: <p>I'm hoping someone can explain why <strong>Directory.GetCurrentDirectory()</strong> returns different results based on how I pass my command line arguments to the application (running with args vs dragging a folder over the app.exe)</p>
  
  <p>To jump right into it consider this piece of code:</p>
  
  <pre><code> public class Program
  {
      static void Main(string[] args)
      {
          Console.WriteLine("The current directory is {0}", Directory.GetCurrentDirectory());
  
          if(args != null &amp;&amp; args.Any())
              Console.WriteLine("Command line arguments are {0}", String.Join(", ", args));
  
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p><br>
  If you build and run this using the command prompt as shown below the output is what you'd expect. It will output the current directory the application resides in.</p>
  
  <pre><code>C:\Projects\ArgumentTest\ApplicationA\bin\Debug\ApplicationA.exe C:\mydirectory
  The current directory is C:\Projects\ArgumentTest\ApplicationA\bin\Debug\
  Command line arguments are C:\mydirectory
  </code></pre>
  
  <p><br>
  If you build and run this program by dragging files or folders over the application you get different results. Instead of returning the expected result instead Directory.GetCurrentDirectory() returns the path to the first file you've dragged over the application.</p>
  
  <p><br>
  I've currently got a work around for this issue however, I am keen to understand why this is happening.</p>
  
  <p>Other info:</p>
  
  <ul>
  <li>.NET 4.5</li>
  <li>Windows 2012R2 (Virtual machine)</li>
  <li>Full administrator rights on the machine</li>
  </ul>
  
  <p>Hopefully someone can provide some insight.</p>