Coding with Titans

so breaking things happens constantly, but never on purpose

Current directory in batch file

Let me test syntax highlighting on this new blog with the following simple snippet.

set CurrentDir=%~dp0
set CurrentDir=%CurrentDir:~0,-1%

It simply gets the full path (drive plus directory) without the trailing backslash, where the executed script is located. It useful in all situations, where you have have other resources next to the script and you don’t want to relay on current working directory to access them.