www.rodneybeede.com "I would love to change the world, but they won't give me the source code" - unknown
  Navigation

Windows Batch Script - Getting Script Location (Directory/Path) - Last Modified 2008-09-26 23:12 UTC - Created 2008-09-26 23:12 UTC

Inside a Windows batch file (.bat or .cmd) you can reference the drive and folder where the batch file is located by:

%~D0
CHDIR %~DP0

The first line causes the script to change to the drive where the script is located.

The second line causes the script to change to the directory where the script is located.

See Call command for further information.