@echo off&setlocal enabledelayedexpansion
set/p .=输入插入前面的字符:
for /f "tokens=1,* delims=:" %%a in ('findstr /n .* 1.txt')do (
if "%%b"=="" (echo.>>#1#.txt
) else (
set var=%%b
set var=%.%!var:~0,-1!
echo=!var!>>#1#.txt
))
pause
#1#.txt就是你要的文本.
@setlocal ENABLEDELAYEDEXPANSION
set "a=开关要加的字符"
for /f "delims=" %%a in (1.txt) do echo %a%%%a>>2.txt
for /f "delims=" %%a in (2.txt) do set b=%%a&echo !b:~0,-1!>>3.txt
del 2.txt /q
pause
mggdx 没写完整。
补全。
@echo off&setlocal ENABLEDELAYEDEXPANSION
if exist 3.txt del 3.txt /q
set /p x=开关要加的字符
for /f "delims=" %%a in (1.txt) do echo %x%%%a>>2.txt
for /f "delims=" %%i in (2.txt) do set b=%%i&echo !b:~0,-1!>>3.txt
del 2.txt /q
start "" 3.txt
pause
这比较好理解