@echo off&setlocal enabledelayedexpansion&pushd %~dps0
for /f "delims=" %%1 in ('type %1')do (set/a a+=1
if "!a!"=="1" (set a=%%1&set a=!a:~4,-1!!a:~-1!&echo !a!>>"%~fn1.tmp")else echo %%1>>"%~fn1.tmp")
move "%~fn1.tmp" "%~nx1"
::将需要处理的文件拖到批处理图标上
::设原文件为test.txt,改后文件为temp.txt
@echo off
for /f "delims=" %%a in (test.txt) do (
set str=%%a
echo.%str:~4%>temp.txt
goto :next
)
:next
more +1 test.txt>>temp.txt
start temp.txt
假设是a.txt
@echo off
set /p Str=
More +1
del a.txt
ren a.txt_ a.txt