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
Only with delayed expansion when you write both statements into the same line:
set BuildDir=%~dp0&&set BuildDir=!BuildDir:~0,-1!
But that kinda defies the purpose.