@echo off
setlocal enabledelayedexpansion
set fn=mima.txt
set T=前N个字符数值
set N=后N个字符数值
(for /f "usebackq delims=" %%i in ("%fn%") do (
set "line=%%i"
set "line=!line:~%T%!"
set "line=!line:~0,-%N%!"
echo !line!
)) > b.txt
move /y b.txt "%fn%"
endlocal