None

Current Directory in a .bat File on Windows

January 13, 2010

I've just noticed an interesting syntax in a batch file on windows.

Here's the contents of the batch file

"%~dp0runme.exe" param1 param2

If you run this, it will replace %~dp0 with the current directory path:

C:\tmp>test

C:\tmp>"C:\tmp\runme.exe" param1 param2
'"C:\tmp\runme.exe"' is not recognized as an internal or external command,
operable program or batch file.

Tested on Windows XP