title: How to return the full path from a command line argument
body: <p>I have an application that can be run from Explorer, and passes the selected directory to the application. So I can use the following code:</p>
  
  <pre><code>private void frmMain_Shown(object sender, EventArgs e)
      {
          //open the dir
          DirectoryInfo d = new DirectoryInfo(cmdArgs);
          SelectDirectoryInTree(d);
      }
  </code></pre>
  
  <p>This however fails if the user selects a Special Folder. The path returned for these folders is different. So, for example, if the user selects <code>Libraries\Documents</code> folder, (or any other folder in there) the returned DirectoryInfo is <code>::{xxxxx-xxxx-xxxxx-xxx-xxxxx}\Documents.library-ms</code></p>
  
  <p>The specific exception:</p>
  
  <pre><code>System.ArgumentException: The path is not of a legal form.
     at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
     at System.IO.Path.GetFullPathInternal(String path)
     at System.IO.DirectoryInfo.Init(String path, Boolean checkHost)
     at System.IO.DirectoryInfo..ctor(String path)
     at FindIt.frmMain.frmMain_Shown(Object sender, EventArgs e) in d:\C#\+Other\FindIt\frmMain.cs:line 476
     at System.Windows.Forms.Form.OnShown(EventArgs e)
     at System.Windows.Forms.Form.CallShownEvent()
     at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
     at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
     at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
  </code></pre>
  
  <p>Whats the simplest way to get the correct folder supplied by the explorer shell?</p>