substrings
The package supports syntax for taking a substring from a string. The general syntax for this is
%string:~start,end%
Main use:
set test=test
echo %test:~2,3%
::st
How does this relate to your question? When a negative number is used as the ending index, the substring stops the set of characters to the end of the line. This behavior makes it easy to drop characters from the end of a line.
set test=test
echo %test:~0,-1%
::tes
source
share