myprogram.cmd is in PATH;
myprogram.cmd uses %~dp0 to determine the folder it is in;
I have included @echo %~dp0 into myprogram.cmd for debugging;
When I call myprogram.cmd from anywhere, it works perfectly, displaying the folder myprogram.cmd is in;
When I call hg extdiff -p myprogram.cmd, it does not work, displaying something like c:\Users\Username\AppData\Local\Temp\extdiff.3n8op2\.
Here is the related part of hgrc file:
[extensions]
hgext.extdiff =
What do I do wrong? Should not %~dp0 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 myprogram.cmd to hg extdiff -p is not an option, unless it is done automatically.
You can try using %~dp$PATH:0, but you need to always specify the extension. For example, for the following
test.cmd:these are two sample runs from the
d:\hgfolder:From http://ss64.com/nt/syntax-args.html: