Even when doing batch files for a long (20+ years!) time, sometimes you learn something new.
Today was such a day.
I wanted to remove a trailing backslash, so I searched with google.
The first hit was a posting by John Kruger showing this little piece of code:
SET Line=C:\Windows\ IF "%Line:~-1%"=="\" SET Line=%Line:~0,-1% echo %Line% — will output: C:\Windows
(note: copy the code above, be careful with the code on John’s site as somehow his double quotes got mangled).
Note that a stackoverflow answer has the same solution.
–jeroen