title: hg extdiff -p and %~dp0
body: <p><code>myprogram.cmd</code> is in PATH;</p>
  
  <p><code>myprogram.cmd</code> uses <code>%~dp0</code> to determine the folder it is in;</p>
  
  <p>I have included <code>@echo %~dp0</code> into <code>myprogram.cmd</code> for debugging;</p>
  
  <p>When I call <code>myprogram.cmd</code> from anywhere, it works perfectly, displaying the folder <code>myprogram.cmd</code> is in;</p>
  
  <p>When I call <code>hg extdiff -p myprogram.cmd</code>, it does not work, displaying something like <code>c:\Users\Username\AppData\Local\Temp\extdiff.3n8op2\</code>.</p>
  
  <p>Here is the related part of <code>hgrc</code> file:</p>
  
  <pre><code>[extensions]
  hgext.extdiff = 
  </code></pre>
  
  <p>What do I do wrong? Should not <code>%~dp0</code> return drive and path of the batch file? What do I use instead? Do I have to apply some special configuration to Mercurial repository? Passing the full path of <code>myprogram.cmd</code> to <code>hg extdiff -p</code> is not an option, unless it is done automatically.</p>