Page 1 of 1

How can I get the path to the batch file being run?

Posted: 18 Jun 2008 16:19
by cmcconn
I have a batch file in my %PATH%. When I run it I need to get it's path so I can open a file that lives in the same folder. I was hoping some sort of built-in variable exists but can't find anything like that. Any ideas would be appreciated.

- Chris

Posted: 19 Jun 2008 00:08
by jeb
Hi Chris,

this should work

Code: Select all

echo path to %0 is %~dp0


jeb