0

Possible Duplicate:
How to get folder path from file path with CMD

I have a Windows .bat script that needs to execute a file that is in the same directory as the .bat file, but the .bat script can be called from any directory. How do you find the location of the batch file itself, not just the current directory?

Community
  • 1
  • 1
Nathaniel Flath
  • 15,477
  • 19
  • 69
  • 94

1 Answers1

1

You can write %~dp0 to get the directory containing the .bat file.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964