title: Why does %~dp1 in a Windows batch file append a backslash when the argument is c:?
body: <p>Given the batch file <code>foo.bat</code></p>
  
  <pre><code>@echo %~dp1
  </code></pre>
  
  <p>In the current directory <code>c:\subdir</code> ... if one executes</p>
  
  <pre><code>c:\subdir&gt;foo c:
  </code></pre>
  
  <p>A Windows 7 command prompt window echoes <code>C:\</code></p>
  
  <p>I would expect <code>C:\subdir\</code></p>
  
  <p>Why is <code>C:\</code> produced when I am referring to the current directory (not the root)?</p>
  
  <p>Dir seems to handle it properly... again given one is in <code>c:\subdir</code>:</p>
  
  <pre><code>c:\subdir&gt;dir c:/b/s
  </code></pre>
  
  <p>yields <code>C:\subdir\foo.bat</code></p>