How to Find the Current Directory in a Batch File in Windows

  • %cd% will give you the current working directory (variable)
  • %~dp0 will give you the full path to the directory the batch file is in (static)
  • %~dpnx0 (which is equivalent to %~f0) gives the full path to the batch file