Suppose I wish to get the absolute path of a batch script from within the batch script itself, but without a trailing backslash.
Normally, I do it this way:
SET BuildDir=%~dp0
SET BuildDir=%BuildDir:~0,-1%
The first statement gets the path with the trailing backslash and the second line removes the last character, i.e. the backslash.
My question is:
Is there a way to combine these two statements into a single line of code?