@echo off & setlocal enabledelayedexpansion
set ifo=abc,def,ghi,jkl,mnopqrstuvwxyz0123456789
echo 原字符串(第二行为各字符的序号):
echo %ifo%
echo.
echo 截取前5个字符:
echo %ifo:~0,5%
echo 截取最后1个字符:
for /f "delims=," %%a in ("%ifo%") do (
set x=%%a
echo !x!
set y=!x:~-1!
echo !y!
)
pause