@echo off setlocal EnableDelayedExpansion set /p row=input replace row: set /p strtext=input replace text: set i=0 for /f "delims=" %%a in (111.txt) do ( set /a i+=1 if !i! == %row% ( echo %strtext% >>222.txt ) else ( echo %%a >>222.txt ) ) del 111.txt ren 222.txt 111.txt type 111.txt echo on
@echo off setlocal EnableDelayedExpansion set /p row=input replace row: set /p strtext=input replace text: set i=0 for /f "delims=" %%a in (111.txt) do ( set /a i+=1 if !i! == %row% ( echo %strtext% >>222.txt ) else ( echo %%a >>222.txt ) ) del 111.txt ren 222.txt 111.txt type 111.txt echo on本回答被提问者采纳